I'd doubt a site would block you from linking to them, but lets pretend for a second that they were.
Lets say you're at google and can't find something so you type in
http://www.yahoo.com in the address bar while still at google. Your browser doesn't send the Referer in the headers to yahoo to tell them you were just at google. However, lets say for whatever reason there was a link on
http://www.google.com to
http://www.yahoo.com. If you click that link, the browser sets the Referer to
http://www.google.com.
Unfortunately even if you linked to your site and sent a header redirect, it will still send your site as the referer : (
Of course I wouldn't give up there, what about a meta refresh? Bingo, at least I think...
Here's my little test script:
Code: Select all
<?php
if ($_GET["redir"] == "header") {
header("Location: http://www.google.com");
} else if ($_GET["redir"] == "meta") {
echo "<html>\r\n<head>\r\n\t<meta http-equiv=\"refresh\" content=\"0;url=http://www.google.com/\">\r\n</head>";
} else {
echo "<html>";
}
?>
<body>
<a href="http://www.google.com">Link to Google</a><br />
<a href="<?php echo $PHP_SELF; ?>?redir=header">Link to header redirect to Google</a><br />
<a href="<?php echo $PHP_SELF; ?>?redir=meta">Link to meta refresh to Google</a>
</body>
</html>
And the header of each:
Link:
Code: Select all
GET / HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
Referer: http://localhost:8900/link.php <------------ Sends the referer
Accept-Language: en-us
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)
Host: www.google.com
Connection: Keep-Alive
Cookie: cookie stuff; testcookie=
Header redirect:
Code: Select all
GET / HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
Referer: http://localhost:8900/link.php <------------ Sends the referer
Accept-Language: en-us
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)
Cookie: cookie stuff; testcookie=
Connection: Keep-Alive
Host: www.google.com
And finally the Meta refresh:
Code: Select all
GET / HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
Accept-Language: en-us
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)
Host: www.google.com
Connection: Keep-Alive
Cookie: cookie stuff; testcookie=
No referer. So if you linked to a file that did a meta refresh to the site, it shouldn't send to the other site that they were just at your site. This may be different in other browsers, at least Firefox works the same as IE...