Paul987 Posted December 5, 2006 Share Posted December 5, 2006 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 More sharing options...
Caesar Posted December 5, 2006 Share Posted December 5, 2006 [code]in php is the http referer passed?[/code][code]<?php $referer = $_SERVER['HTTP_REFERER'];?>[/code] Link to comment https://forums.phpfreaks.com/topic/29567-php-redirect/#findComment-135705 Share on other sites More sharing options...
Paul987 Posted December 5, 2006 Author Share Posted December 5, 2006 Hi, does it pass the referer? I cant test it cause i dont have a php server. Only asking the question. Link to comment https://forums.phpfreaks.com/topic/29567-php-redirect/#findComment-135713 Share on other sites More sharing options...
trq Posted December 5, 2006 Share Posted December 5, 2006 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 More sharing options...
Paul987 Posted December 5, 2006 Author Share Posted December 5, 2006 Hmm, there must be a way to do it :-\ ??? Link to comment https://forums.phpfreaks.com/topic/29567-php-redirect/#findComment-135722 Share on other sites More sharing options...
mainewoods Posted December 6, 2006 Share Posted December 6, 2006 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.