Question about 301 redirect

Discussion in 'PHP' started by sonofsam, Jul 6, 2007.

  1. #1
    I'm using

    <?
    Header( "HTTP/1.1 301 Moved Permanently" );
    Header( "Location: http://www.DOMAIN-I-WANT-TO-SEND-TO.com" );
    ?>

    to manage my affilitate traffic

    so when i want to change the affiliate program i want to send traffic to, i just change that domain..

    but is there any problems with changing the url often?

    i had www.mydomain.com/linktracker18.php directing my traffic to one site using the 301 redirect.. and then i changed the site it was going to... but when i type in mydomain.com/linktracker18 it is still going to the first site... why is that?

    is it because its cached or something? is this going to cause any problems?
     
    sonofsam, Jul 6, 2007 IP
  2. sonofsam

    sonofsam Peon

    Messages:
    268
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #2
    also.. is a 301 redirect the easiest way to manage my traffic by niche?

    have like niche1.php niche2.php etc.. and have each of them have a 301 redirect to the place i want to send my niche1 traffic to etc?
     
    sonofsam, Jul 6, 2007 IP
  3. ecentricNick

    ecentricNick Peon

    Messages:
    351
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I pulled up the headers received thorugh wget, and it didn't send a redirect header at all? You sure the code is getting executed?
     
    ecentricNick, Jul 6, 2007 IP
  4. sonofsam

    sonofsam Peon

    Messages:
    268
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #4
    the domain i used as an example is not a real domain... not mine anyways... i was just using it as an example
     
    sonofsam, Jul 6, 2007 IP
  5. ecentricNick

    ecentricNick Peon

    Messages:
    351
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Well, can't offer that much help. But it is perfectly legitimate for a browser or even a isp proxt to cache a 301 redirect as it is considered a *permanent* redirect hence not expected to change.

    If you list the real domain, then I may be able to offer more help. But, do what I did, write a script that requests the headers from your url and see if you get what you expect.
     
    ecentricNick, Jul 6, 2007 IP