No credit card. Takes under a minute.

Login
INSIGHTS2 MIN READ

How To Cloak Your Affiliate Links Using A PHP Redirect

bigeckl57

Published on June 21, 2016

Published on Wealthy Affiliate — a platform for building real online businesses with modern training and AI.

You want to learn How To Cloak Your Affiliate Links Using A PHP
Redirect.

Cloaking is actually a redirect, when the link is clicked on, it
will change to the link of the sales page for your own affiliate
product.

There are many reasons why you should cloak your affiliate links
with PHP.

The first reason is that Google doesn't like affiliate links.

The second reason is than there are some internet marketers who
would like to take your affiliate links and insert their own
links into them.

The structure of Clickbank hop links is not offering you any
protection and it is easy for other people to use your links.

It is not difficult to do the PHP redirect cloaking and you don't
need to buy some fancy paid plugin to do this.

Ready to put this into action?

Start your free journey today — no credit card required.

Here are some easy steps that can teach you how to do the PHP
redirect cloaking.

You should first get your own affiliate link and paste it into a
notepad.

After that, you need to paste the following code into a notepad
as well:

<?php
header(“Location:hxxp://youraffilatelink.”);
exit;
?>

At the end you just need to take your affiliate link and insert
it into the above code while changing “hxxp” to “http”.

You can save this notepad file under any name and you should use
a .php extension for your file.

In order to save your file as a .php file instead of saving it as
a .txt file, you just need to click on the drop down menu and
select "All files".

Next thing you need to do is to go to your file manager in CPanel
and create a new folder that is in the root of your domain.

All you need to do now is to upload the .php file you have just
created into that folder.

Your affiliate link is now cloaked and protected from other
internet marketeers.

John Eckl

Share this insight

This conversation is happening inside the community.

Join free to continue it.

The Internet Changed. Now It Is Time to Build Differently.

If this article resonated, the next step is learning how to apply it. Inside Wealthy Affiliate, we break this down into practical steps you can use to build a real online business.

No credit card. Instant access.

2.9M+

Members

190+

Countries Served

20+

Years Online

50K+

Success Stories

The world's most successful affiliate marketing training platform. Join 2.9M+ entrepreneurs building their online business with expert training, tools, and support.

Member Login

© 2005-2026 Wealthy Affiliate
All rights reserved worldwide.

🔒 Trusted by Millions Worldwide

Since 2005, Wealthy Affiliate has been the go-to platform for entrepreneurs looking to build successful online businesses. With industry-leading security, 99.9% uptime, and a proven track record of success, you're in safe hands.