How to preserve referrer url when redirecting with php to affiliate site

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Cyber Fucker
    Hmm
    • Sep 2005
    • 12642

    #1

    Tech How to preserve referrer url when redirecting with php to affiliate site

    Gfy techs help!

    I made a page with simple redirection, something similar to:

    Code:
    header("HTTP/1.1 301 Moved Permanently");
    header("Location: $_SERVER['QUERY_STRING']", true, 301);
    exit;
    It works as intended, but I can't see the referring url in affiliate programs stats.
  • mce
    Confirmed User
    • Jun 2012
    • 3915

    #2
    I'd love to see the answer too. Here's a bump for you, my man.

    Pay Virtual Assistants Based on RESULTS instead of TIME
    STOP getting FUCKED IN THE ASS by your VA

    Comment

    • Klen
      • Aug 2006
      • 32234

      #3
      Hmm that should do the job, could be simply how program stats are broken or they have multiple redirects which deletes original refferer so you cant do shit with it. Ask sponsor for tracking id, where you would put your refferer url.

      Comment

      • Cyber Fucker
        Hmm
        • Sep 2005
        • 12642

        #4
        Nah, that's not the sponsor thing I think, at least not a single case, I could be wrong though. I tested on a few. I think it's just the way php and web browsers work, same with javascript, it would not pass the referrer. But server redirection on the other hand like in htaccess would. I believe though there must be some way to trick browsers with php to pass it. Reading stackexchange at the moment, but the more I read the more mess is in my head and it's already suffering tonight from a headache. So I have thought, that perhaps someone here done it before and will save me a bit of time and struggle.

        Comment

        • Bladewire
          StraightBro
          • Aug 2003
          • 56220

          #5
          Code:
          <?php
           
          $redirect_page = "https://www.example.com/page-two.php";
           
          if($_SERVER['QUERY_STRING']){
           
          $query_sign = "?";
           
          }else{
           
          $query_sign = "";
           
          }
           
          header("Location: $redirect_page.$query_sign".$_SERVER['QUERY_STRING'], true, 301);
           
          exit;
           
          ?>


          Skype: CallTomNow

          Comment

          • sarettah
            see you later, I'm gone
            • Oct 2002
            • 14327

            #6
            Originally posted by Cyber Fucker
            Gfy techs help!

            I made a page with simple redirection, something similar to:

            Code:
            header("HTTP/1.1 301 Moved Permanently");
            header("Location: $_SERVER['QUERY_STRING']", true, 301);
            exit;
            It works as intended, but I can't see the referring url in affiliate programs stats.
            Easiest way I know is to do a HTML Meta refresh. The referer gets passed that way.

            Code:
            <meta http-equiv="refresh" content="0; url=page_to_go_too">
            So, if you are doing it via php, something like this:

            Code:
            <html>
            <head>
            <meta http-equiv="refresh" content="0; url=<?php echo $_SERVER['QUERY_STRING']; ?>"> 
            </head>
            <body>
            </body>
            </html>
            All cookies cleared!

            Comment

            • Bladewire
              StraightBro
              • Aug 2003
              • 56220

              #7
              Originally posted by sarettah

              Code:
              <html>
              <head>
              <meta http-equiv="refresh" content="0; url=<?php echo $_SERVER['QUERY_STRING']; ?>"> 
              </head>
              <body>
              </body>
              </html>





              Skype: CallTomNow

              Comment

              • Paz
                Confirmed User
                • Jun 2012
                • 457

                #8
                Originally posted by Cyber Fucker
                It works as intended, but I can't see the referring url in affiliate programs stats.
                Some good suggestions already, also if you are redirecting from https to http you won't pass the referrer plus some browser settings and devices don't pass referrer as well.

                Comment

                • freecartoonporn
                  Confirmed User
                  • Jan 2012
                  • 7683

                  #9
                  Originally posted by Bladewire



                  SSD Cloud Server, VPS Server, Simple Cloud Hosting | DigitalOcean

                  Comment

                  • sarettah
                    see you later, I'm gone
                    • Oct 2002
                    • 14327

                    #10
                    Originally posted by Bladewire



                    Originally posted by freecartoonporn


                    Is there a problem with my solution? Or am I mis-interpreting something?

                    Proof of concept:

                    http://www.hatterasdesigns.com/testr...test_redir.php

                    Code:
                    <html>
                    <head>
                    <meta http-equiv="refresh" content="0; url=<?php echo $_SERVER['QUERY_STRING']; ?>"> 
                    </head>
                    <body>
                    </body>
                    </html>

                    The madspiders.com page simply echoes the referer

                    Code:
                    <?php
                    echo "referer is " . $_SERVER['HTTP_REFERER'];
                    ?>
                    .
                    All cookies cleared!

                    Comment

                    • woj
                      <&(©¿©)&>
                      • Jul 2002
                      • 47880

                      #11
                      you are supposed to do the opposite (hide the referer), so the sponsor doesn't steal your traffic sources/methods/etc...
                      Custom Software Development, email: woj#at#wojfun#.#com to discuss details or skype: wojl2000 or gchat: wojfun or telegram: wojl2000
                      Affiliate program tools: Hosted Galleries Manager Banner Manager Video Manager
                      Wordpress Affiliate Plugin Pic/Movie of the Day Fansign Generator Zip Manager

                      Comment

                      • Cyber Fucker
                        Hmm
                        • Sep 2005
                        • 12642

                        #12
                        Originally posted by woj
                        you are supposed to do the opposite (hide the referer), so the sponsor doesn't steal your traffic sources/methods/etc...
                        Maybe you are right. I was thinking about it. All in all I got details on my end in my own logs (that was the whole purpose of this redirection page, so that programs don't cheat me on the actual numbers) and also there are campaign tools in most programs that can shed some light on the question where the traffic comes from. So yeah, maybe you are right.

                        Comment

                        • Bladewire
                          StraightBro
                          • Aug 2003
                          • 56220

                          #13
                          Originally posted by sarettah
                          Is there a problem with my solution? Or am I mis-interpreting something?
                          I was complimenting you on the clean code Sarettah! Line 3 specifically






                          Skype: CallTomNow

                          Comment

                          • shake
                            frc
                            • Jul 2003
                            • 4663

                            #14
                            Originally posted by woj
                            you are supposed to do the opposite (hide the referer), so the sponsor doesn't steal your traffic sources/methods/etc...
                            I used to always re-direct through a fake tgp to show sponsors a legit looking referer.
                            Crazy fast VPS for $10 a month. Try with $20 free credit

                            Comment

                            • sarettah
                              see you later, I'm gone
                              • Oct 2002
                              • 14327

                              #15
                              Originally posted by Bladewire
                              I was complimenting you on the clean code Sarettah! Line 3 specifically
                              Ok, I wasn't sure how to take it. Sorry about that.

                              .
                              All cookies cleared!

                              Comment

                              • freecartoonporn
                                Confirmed User
                                • Jan 2012
                                • 7683

                                #16
                                Originally posted by sarettah
                                Is there a problem with my solution? Or am I mis-interpreting something?
                                i about the GIF.
                                SSD Cloud Server, VPS Server, Simple Cloud Hosting | DigitalOcean

                                Comment

                                Working...