How to Cloak Your Affiliate Links on a Normal HTML Website - Viral Tech

Go to content

How to Cloak Your Affiliate Links on a Normal HTML Website

Cloaking your affiliate links essentially hides the affiliate URL from your visitors and even search engines. Rather than the link or code being displayed on your website, this is stored within a file which when clicked on redirects people to the appropriate link. In fact, you can use this method for any link, regardless whether it's an affiliate or a link directly to a website.

It's generally believed that cloaking your affiliate links is a good idea, as this can prevent your affiliate link code from being abused from website scrapers who may scrape your contents and have it displayed on their website, which may violate the affiliate program you're using.

Some even say it can improve your website ranking within Google, as Google takes a pretty dim view of affiliate websites because so many of them are of a low quality. Google doesn't really say whether it penalises affiliate websites, but makes it clear that they should be of the highest quality and offer something unique to the visitor.

If you want to cloak your affiliate links using a program such as WordPress, then the process is fairly straightforward as there are countless plug-ins available which will do the job for you. However, if you use a desktop web design software, one which essentially allows you to build your website on your computer and then publish it to the Internet, then you're probably wondering how this is achieved?

Do a Google search for "how to cloak your affiliate links on a normal HTML website" and the search results are predominantly how to do it on a WordPress blog, not a normal website, even though we haven't actually mentioned the word WordPress. When you actually do find a website that isn't about WordPress, the process of cloaking your links is usually both confusing and way too complicated.
So, How Do You Cloak Your Links on a Normal Website?
Actually, the process is extremely simple. If you're using any modern web design software that was made within the last 10 years, then it will most likely give you the option to add a file, usually by the "insert a link" option. For example, you can highlight a piece of text or even a image on your website and then select "insert a link" which should then give you the option to insert a link or file. Obviously, every piece of software will vary slightly, and if you don't know where the add link/file option is then simply visit the manufacturer's website for more info.

How Do You Create the Affiliate Cloaking File?
For this were going to use a website called, which allows you to paste in your affiliate or any general URL into a search box which is then turned into a file that you can download onto your computer and insert it into your website which will then get uploaded to the Internet, once published.

For example, if you're using Amazon's affiliate program, all you have to do is sign in with your username and password, go to a product that you want to promote, and simply click on "Text" on the get link toolbar at the top of the page. Amazon, at long last, now allow short links rather than long lengthy HTML code for your website. A short link will look something like this –, and all you have to do is simply copy and paste this code into and click on the "generate" button. After that, you'll be given the option to download your file in 3 formats. 1st option is for "redirect with hidden URL", 2nd option is "direct forwarding" and the 3rd option is "with PHP scripting".

The 1st option will essentially redirect anybody who clicks on your link to the desired website, yet it will display the URL of your website within the web browser. The 2nd option will redirect anybody who clicks on your link and display the URL of the actual website that they have been redirected to. The 3rd option is for PHP based websites which has nothing to do with this guide as this is about HTML websites.

To be on the safe side, I would only use option 2, which is direct forwarding because it can be against the rules of some affiliate programs, If you attempt to hide the URL of the actual website selling the products.

Once you click on the download link, you will be given the option to name your file. It's very important to give your file a unique name, for example the name of the product, et cetera. If you give your file the same name, then your web design software will get confused and just start linking to the same page every time you use that file, even though it contains a different URL.

Once your file has been downloaded to your PC, which should take a matter of seconds as the file itself will be tiny in size, you simply need to highlight the desired text or image with the web design software that you are using and add that file which is usually done by selecting the insert a link option with many software programs.

Once the file has been added it will be stored by your web design software program and uploaded to the Internet once you select the publish option. It really is as easy as that, and the whole process probably only takes 30 seconds more than adding a normal affiliate link to your website. Naturally, if you have a website that has hundreds or even thousands of affiliate links already published, and you want to cloak everyone using this method, then it's not going to be quick process, but it may be your best or only option.

Always remember to check your affiliate link, once you've published your website to make sure it is working correctly. You may also want to check the terms and conditions of the affiliate program you are using as some may not allow you to cloak your links, though generally it shouldn't be a problem with 99% of them.
How to Stop Your Affiliate Cloaking File from Being Indexed by Search Engines
You may find that when you add your affiliate link file that it gets indexed and listed on search engine such as Google. This will totally depend on the affiliate program you're using and the page you are linking to. For example, if you link directly to a Amazon product page, this will most likely get indexed. If your affiliate links do start getting indexed, this could have a negative effect on your site search engine performance, and therefore its a good idea to stop this.

This should be easily achievable by using the robots.txt file, which in most cases is created automatically by your web design software. If it isn't, you can easily create one yourself by following this guide.

As previously stated when you create your affiliate cloaking file and add it to your site, it will be stored somewhere within your web design software. Some web design programs allow you to choose or create a folder where these will be stored, and some do not, as in my case.

If the web design software allows you to choose a destination where the affiliate cloaking files will be stored, then all you have to do is add the name of the folder where they are stored to your robots.txt file using an FTP program.

For example, if your web design software uses a simple URL structure you probably just have to add the line Disallow: /files to your robots.txt file, or whatever the name of the folder is.

You may find that your software already automatically blocks files from being indexed, but you should double check just to make sure.

If you don't have the option to store your affiliate cloaking files in a designated folder, then you need to save the file by using a first dedicated word. For example, I save all my files by using the word "redirect" followed by a space and then the name of the file.

Example: redirect samsungtvs101.

It's very important that you leave a space between your chosen word, followed by the file name.

I then add Disallow: /contents/en-uk/redirect to my robots.txt file, which will then block all files starting with the word "redirect".

I have to add /contents/en-uk/ because the software I'm using doesn't use a simple URL structure, but if yours does, then you probably just have to add /redirect to the robots.txt file.

As always, if you not familiar with the robots.txt file with your particular software, then visit the manufacturer's websites or a dedicated forum where other users will be able to advise you.

A Non-Robots.txt Method
If you don't want to fiddle around with your robots.txt file, then you can insert a piece of code into your affiliate cloaking file that you've downloaded telling search engines you don't want it to be followed or indexed.

For example, once you've downloaded your file from, you can open and edit it using notepad. To do this, you simply right click on the file which is saved on your computer and select Open with > Notepad.

Once the file is opened, it will look something like this.

You need to add the following line <meta name="robots" content="none" /> just below the <HEAD>. Once you've added it select Save from the File option in the top left-hand corner and close it.

You can now add that file to your website and once published search engine robots will be instructed not to follow or indexed any links within that file.
Add a comment
comments powered by Disqus
Why Haven't There Been Any Updates?
You may have noticed that the blog section, or even the general website hasn't received any major updates recently.
Published by Webmaster - 19/12/2019
The New RT-AX88U Wi-Fi 6 Router from Asus
You've probably never heard of it, or not until now, but Asus is releasing a new Wi-Fi 6, or 802.11ax wireless router.
Published by Webmaster - 2/11/2018
The Camera Happy A9 Phone from Samsung
South Korean electronics manufacturer Samsung's is adding a new phone to A Series called the Galaxy A9 and its the world's first smartphone with four rear cameras.
Published by Webmaster - 17/10/2018
A New Phone from Razer Called the Phone 2
About a year ago, Razer, more commonly known for making game accessories, released its first phone. Now they've had a second attempt and named it simply the Razer Phone 2.
Published by Webmaster - 16/10/2018
Google Decides to Pull the Plug on Its Social Media Platform, Google Plus
After low user engagement and the discovery of a software error, that potentially exposed the data of hundreds of thousands of its users, Google has decided to pull the plug on its social media platform.
Published by Webmaster - 15/10/2018
Copyright © ViralTech.Co.Uk - All Rights Reserved
Back to content