Faking Backlinks using the Referrer

Trickery on the HTTP referrer to fake backlinks

Trickery to Fake Backlinks with the HTTP Referrer


Hello World.
Now, in the world of SEO, backlinks are king.
A big part of the Black Hat scene is all about getting links by any means possible. As I mentioned in a previous post, the great thing I love about the black hat SEO scene is the ingenuity creative thinking that gets employed once the question of ethics has been removed.
A great example of this is a little bit of code I put together a few months ago.

The basic idea is quite simple:

  • Get the domain name of the referrer
  • Save it to a cookie
  • Dynamically generate a backlink from the cookie

The benefit being that without the cookie, there is no backlink. And, of course, Google doesn’t do cookies so he sees no backlink.
The user has cookies and so they see the link, even if they clear the cache, even if they come back in a few days, even if they click another link to the page or fake the referrer.

  • The user sees a 100% legitimate looking backlink to their site
  • Google/Everyone else sees no backlink

So, next we use a program like scrapebox to comment on millions of Blogs with a message to the effect of

“Hey this isn’t a spam comment, I’m trying to get in touch with the webmaster here about a link exchange. I already linked to you from my site here: domain.com/usefullinks please contact me on *our email address* to discuss!”

The Webmaster clicks on the link and visits our site, Spots a great dofollow link back to his domain and then hopefully sets a backlink to us on his site or sends us an email…

Again, the beauty here is that the backlink that the visitor sees is dynamically generated and doesn’t really exist but if the visitor clears his cache and reloads the page or checks again in a few days, he will still see his backlink there. A glistening dofollow, text backlink.

We achieve this by using some cool PHP and cookies.
it’s a bit complex so bear with me as I do my best to explain how it all works….

Firstly, what we are going to do is create a file called “useful-links.php” and copy in the code below (or simply download it from the link above)

if (isset($_COOKIE['link'])){
header("Location: http://". $_SERVER['HTTP_HOST'] . "/useful-links");}
$refurl = current($urlArray);
setcookie("link",$refurl, time()+999999999);
header("Location: http://". $_SERVER['HTTP_HOST'] . "/useful-links");

Upload this to the root level of your domain

We will link everyone to the page domain.com/useful-links.php which will get the referrer domain and save it into a cookie before sending the user on to domain.com/useful-links. All of which takes place in less than a second meaning the average user won’t notice a thing.

Now on domain.com/useful-links all we have to do is read the cookie and show the link.


Simply create the page domain.com/useful-links and give it the following content

<-- insert as many genuine links as you see fit. Link to authority pages like BBC.co.uk and Wikipedia.org -->
<li><a href="http://www.example.com">http://www.example.com</a></li>
<li><a href="http://www.example.com">http://www.example.com</a></li>
<-- Here we check to see if the cookie has been set, if so we display the fake link ^_^ -->
if (isset($_COOKIE['link'])){
echo "<li><a href=\"" . $_COOKIE['link'] . "\">" . $_COOKIE['link'] . "</a></li>";
<li><a href="http://www.example.com">http://www.example.com</a></li>

For the added little touch of making the two URLs look more similar what we can do is add a single line into your .htaccess file that redirects domain.com/usefullinks to our domain.com/useful-links.php file.

redirect 301 /usefullinks http://www.domain.com/useful-links.php

Now you can link to domain.com/usefullinks in blog comments and so on, and all the backlink fakery executes automatically.

When I have used this trick I have had some great success and got some solid links that I would otherwise never have got.
It works best when contacting higher PR established websites in the same niche as you, especially ones that have little or no SEO knowledge and think that swapping links is a good idea.

OK test it out, let me know your thoughts…

I have an even more powerful way to use this trick coming up in my next post so stay tuned for more!
or follow me on twitter to keep up to date with the latest ;)