PHP Redirect + Keep Referrer..??

x5g7j9l3x

Junior Member
Joined
Feb 20, 2009
Messages
127
Reaction score
1
Code:
<?php
$URL = $_SERVER['QUERY_STRING'];
header("Location: $URL");
?>

That PHP code will redirect you to whatever URL you put after the ? ['QUERY_STRING'] in yer URL string..

So when you directly visit "http://my-site.com/?http://stardrifter.org/cgi-bin/ref.cgi" by pasting it in yer browsers URL & hitting GO
it will redirect to "http://stardrifter.org/cgi-bin/ref.cgi"
which is a site that tells you yer referrer..

But when you directly visit "http://my-site.com/?http://stardrifter.org/cgi-bin/ref.cgi"
NO REFERRER IS DISPLAYED at "http://stardrifter.org/cgi-bin/ref.cgi"..!!!

The Function "header("Location: $URL");" strips out the referrer..

How can I make the referrer either display as "http://my-site.com/?http://stardrifter.org/cgi-bin/ref.cgi" or the root of the site that it gets redirected to "http://stardrifter.org"..??
 
hey man, this is the wrong section for what you are looking

here is the PHP section :)

http://www.blackhatworld.com/blackhat-seo/f127-php-perl/
 
.
Just use:
Code:
<?php
header("Location: http://stardrifter.org/cgi-bin/ref.cgi");
exit;
?>


HTH .... :cool2:
​
 
I think you are wrong. That header redirect does not strip the referer.

google.com?q=keyword -> .php file with header("Location:$url) -> domain.php


At domain.php the referer will be google.com?q=keyword

You either haven't fully disclosed what you are doing or your browser settings are at fault, but your redirection as you have stated should not strip the referer.
 
are you clicking a link that goes to php file with header("Location:$url)
if you are then it will show referrer as google.com?q=keyword
but if you do like i say in my 1st post by directly visit "http://my-site.com/?http://stardrifter.org/cgi-bin/ref.cgi" by pasting it in yer browsers URL & hitting GO
Now tell me what referrer it shows for you..??
Note... http://my-site.com/? is not a real site.. it is meant for your actual site..
test please an let me know what the page "http://stardrifter.org/cgi-bin/ref.cgi" says is yer referrer..??
 


I don't understand WTF you are asking??? ..... :wt:

If you put your string in the address bar and hit enter it goes to whatever domain you entered to the left of the ? and NOT to

Code:
http://stardrifter.org/cgi-bin/ref.cgi
In my particular case on several of my domains it goes to a forbidden page:
Forbidden You don't have permission to access / on this server.
because you can't do it for security reasons .....

HTH .... :cool2:

​
 
Last edited:
Back
Top