Many affiliate links are long, ugly looking things that make savvy surfers think twice about clicking them. Wouldn’t it be nice to dress them up a little or completely shorten them into something more memorable? Welcome to the dark world of link obfuscation and link masking aka hiding link addresses.
There are two ways to make links more appealing:
- URL redirects
- URL masking
Redirects are achieved through a script, a meta refresh, a URL rewrite or through a URL shortening service; and URL masking is done by adding a few extras to the <a> tags.
URL Redirects
When attempting to hide affiliate links from search engines (some webmasters believe search engines penalize them) add the NOFOLLOW attribute to <a> tags. Doing so should prevent search engines from following links to the intermediary link which redirects visitors to the affiliate URL. For example <a href=”http://travelbudgie.com” rel=”nofollow” title=”Low cost travel”>TravelBudgie</a>.
Using a Script
This simple PHP redirection script requires you to create a file called urlredirect.php and place a modified form of the following code into it:
<?PHP
if ($o == "1") {$link = "http://www.google.com";} // Default link
if ($o == "2") {$link = "http://www.yahoo.com";}
if ($o == "3") {$link = "http://bing.com";}
if ($o == "4") {$link = "http://journalxtra.com";}
header("Location: $link"); // Jump to the hidden affiliate URL above
exit();
?>For every affiliate link you want to redirect, add a line into the above script that contains the text
if ($o == "LINK NUMBER″) {$link = "AFFILIATE LINK”;}Upload the file to your webserver and wherever you want to use one of the affiliate links listed in the file, put the following code in its place
<a href="http://www.YOURSITE.com/urlredirect.php?o=LINK NUMBER" rel="nofollow">DESCRIPTION</a>
For example:
to link to Google, you would use
<a href="http://www.YOURSITE.com/urlredirect.php?o=1" rel="nofollow">Google</a>
or
to link to Bing, you would use
<a href="http://www.YOURSITE.com/urlredirect.php?o=3" rel="nofollow">Bing</a>
Notice that Google is item number 1 in the PHP file as indicated by
if ($o == "1")
so the link to it calls item number 1 with
urlredirect.php?o=1
Add as many such lines as needed and edit it whenever you need to add another affiliate link. This script can be used with any website including WordPress.
As well as PHP scripts there are many written in Javascript and other scripting languages. A quick google will point you toward them.
Meta Refresh
This simply tells a web browser to refresh a page after a given time and redirect visitors to a given URL.
To use this to hide an affiliate link from visitors we create a blank html page and tell it to refresh and redirect as soon as it’s visited. The code for this html page is
<html> <head> <title></title> <meta http-equiv="refresh" content="0;url=AFFILIATE URL" /> <style></style> </head> <body></body> </html>
The active bit of code is
<meta http-equiv="refresh" content="0;url=AFFILIATE URL" />
The html page can be called anything e.g learn-the-secrets.html or make-money-now.html, it doesn’t matter; all that matters is that when you want to send visitors to your affiliate link, instead of sending them to http://this-big-ugly-affiliate-link-is-sooo-obvious.com you send them to the html page created to redirect them to it.
For example:
- To redirect a visitor to http://this-big-ugly-affiliate-link-is-sooo-obvious.com, create a meta refresh html page called sexy-secrets.html and upload it to your website so that its URL is http://YOURSITE.COM/sexy-secrets.html
- Wherever you want to direct visitors to http://this-big-ugly-affiliate-link-is-sooo-obvious.com, use the link
http//yoursite.com/Sexy Secrets
When visitors click the Sexy Secrets link they will go to http://yoursite.com/sexy-secrets.html which will refresh immediately a browser reaches it and send the visitors to http://this-big-ugly-affiliate-link-is-sooo-obvious.com
URL Rewrite Using htaccess (301 Redirects)
If you use an Apache server you can instruct it to intercept a URL and redirect it. It’s most likely that you already have an htaccess file on your server but if you don’t you can create one using your server management program (e.g cPanel). If you create one it is important that you put a full-stop in front of its name e.g call it .htaccess not htaccess. The naming convention comes from Linux and denotes a hidden file (also called a dot-file).
To set-up a 301 redirect
- open your .htaccess file
- on a new line, add the code
Redirect 301 /YOUR LINK http://AFFILIATE LINK
- repeat step 2 for as many affiliate links as you want to redirect visitors,
- direct visitors to your AFFILIATE LINK by sending them to YOUR LINK
For example:
To redirect someone to http://my-big-affiliate-link.com using the nicer link of http://yoursite.com/sexy-link.html, add the following line to the .htaccess file
Redirect 301 /sexy-link.html http://my-big-affiliate-link.com
Whenever visitors click http://yoursite.com/sexy-link.html they will be redirected to http://my-big-affiliate-link.com
URL Shortening Services
There are many URL shortening services, too many for me to mention them all here but a few to get you going are:
If you use WordPress you can create your own URL shortening service using your own domain’s URL. One plug-in that makes this possible is Pretty Links.
URL Masking
This is done by adding a few extras to <a> tags. It doesn’t involve any redirects and causes web browsers to report a false URL to the visitor. The code for a masked link looks similar to this
<a href="FAKE URL" onclick="document.location.href = 'REAL URL'; return false;" title="ANCHOR TEXT">CLICK HERE</a>
A typical <a> tag looks like this
<a href="REAL URL" title="ANCHOR TEXT">CLICK HERE</a>
The masked URL uses onclick and return false to hide the real URL.
For example:
To mask a link to http://this-affiliate-link-is-sooo-loong-and-ugly.com by covering it with http://nice-and-simple.com, just create an <a> tag as
<a href="http://nice-and-simple.com" onclick="document.location.href = 'http://this-affiliate-link-is-sooo-loong-and-ugly.com'; return false;" title="ANCHOR TEXT">PRETTY LINK</a>
I think this is the best way to hide a URL: it’s sneaky (in a good way) but less scheming so it doesn’t appear as a scam (which it isn’t and shouldn’t be).
Hover your cursor over this link and look at the bottom left hand corner of your browser.
Any message can be displayed in the bottom left corner of the browser when a link is hovered over, it’s just nice to exploit the message area to return a fake link destination when required.
Methods that mask links can be incorrectly picked up on by RSS readers. I’ve lost sales to the mask being read as the link instead of the mask covering the link. For example,
if I make a link for “http://journalxtra.com/go/subliminalMP3-2” display in a browser as “google.com” then RSS readers (and scrapers) will sometimes attach google.com to the anchor text and omit http://journalxtra.com/go/subliminalMP3-2 (the affiliate link).
I’ve noticed it when using onclick=”document.location.href = ‘REAL URL’. I suspect Java might suffer the same problem.
So, if you are worried about RSS feeds, use .htaccess, php or some other link redirection to hide your affiliate URLs.
Copyright secured by Digiprove © 2010
Related posts:


















No Responses to “Mask Your Affiliate URLs”