Jump to content

php redirect


Paul987

Recommended Posts

Hi, i dont know php but am interested to know one thing. When you do a server side relocation in php is the http referer passed? I use coldfusion and it doesnt pass it. Reason is i see alot of topsites and link tracking systems use php to track hits they are sending out but if it wasnt passing the http referer when it sends the user to the new site it wouldnt be any good as you wouldnt get any credit for sending that visitor, so im thinking that it must be doing it in php?? Thanks for your help. Paul
Link to comment
https://forums.phpfreaks.com/topic/29567-php-redirect/
Share on other sites

It appears not. I setup a test as follows. Page a.php had a link to page b.php, page b.php used a redirect to page c.php.

c.php
[code]
<?php
  echo "You came from {$_SERVER['HTTP_REFERER']}";
?>
[/code]

Upon visiting page a.php and clicking the link to b.php I was redirected to c.php and viewed the message...

[quote]
You came from http://mydomain/a.php
[/quote]
Link to comment
https://forums.phpfreaks.com/topic/29567-php-redirect/#findComment-135718
Share on other sites

I would think thorpe's test shows that it would work ok, like this:

--add is displayed on page a.htm on your website
--the add contains link: yourwebsite.com/trackhits.php?addnum=?????
--the link goes to the trackhits.php page on your website which uses the addnum variable passed to add 1 to that adds hits and then redirect to the proper web site:
[quote]header("location:  ???????"):[/quote]
--now according  to thorpe's test it would send the first page that the add is on as the referer, not the php trackhits page, which is exactly what you want.

One note though, thorpe's test is browser dependent, the referer is set by the browser, not the sever.  Which means it might work differently on different browsers. 
Link to comment
https://forums.phpfreaks.com/topic/29567-php-redirect/#findComment-135877
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.