August 18, 2008, 10:07 am
These codes are useful for hiding the affiliate links. However, please read the affiliate program terms of service, so that you won’t go against it.
For all except the last way (.htaccess redirect), create the respective file for each affiliate link with the code for the chosen redirect style. Replace ‘http://your-affiliate-link-goes-here’ with the URL of the affiliate link.
For example, if you choose to use the PHP redirect, first create a PHP file. Copy and paste the PHP redirect code into that file. Replace ‘http://your-affiliate-link-goes-here’ with the affiliate link URL.
Every time you want to link to the affiliate link, just link to that file.
You have to create new file for each affiliate link.
- HTML redirect
1
2
3
4
5
6
7
8
9
10
| <html>
<head>
<title>HTML Redirect</title>
<meta http-equiv="refresh" content="0; url=http://your-affiliate-link-goes-here">
</head>
<body>
Please wait. Redirecting...
</body>
</html> |
- PHP redirect
1
2
3
| <?php
header("Location: http://your-affiliate-link-goes-here");
?> |
- ASP redirect
1
2
3
4
| <%@ Language=VBScript %>
<%
Response.AddHeader "Location","http://your-affiliate-link-goes-here"
%> |
- ASP.NET redirect
1
2
3
4
5
6
| <script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
Response.AddHeader("Location","http://your-affiliate-link-goes-here");
}
</script> |
- Coldfusion redirect
1
| <.cfheader name="Location" value="http://your-affiliate-link-goes-here"> |
- JSP redirect
1
2
3
4
| <%
response.setHeader( "Location", "http://your-affiliate-link-goes-here" );
response.setHeader( "Connection", "close" );
%> |
- cgi Perl redirect
1
2
| $q = new CGI;
print $q->redirect("http://your-affiliate-link-goes-here"); |
- Ruby on Rails redirect
1
2
3
| def old_action
redirect_to "http://your-affiliate-link-goes-here"
end |
- Apache .htaccess on Linux
Add this code to the end of .htaccess file. Replace ‘http://your-affiliate-link-goes-here’ with the affiliate link URL. To have more than one affiliate link, just add another RewriteRule.
1
2
| RewriteEngine on
RewriteRule ^affliate.php$ http://your-affiliate-link-goes-here [R] |
If you liked this post, these other posts might also be interesting to you:
Tags:
affiliate,
apache,
asp,
cfm,
html,
jsp,
perl,
PHP,
ruby,
WordPress Category:
Blog Tips,
PHP |
Comment (
RSS) |
Trackback
Jeff:
The question is WHY would you want to hide the affiliate link? I’m sure there is a good reason, but it escapes me.
August 18, 2008, 12:28 pmkipram:
Nice Blog Design, whre i can get this theme
kiprams last blog post..Cara Gampang Mengalahkan SEO Master
August 18, 2008, 1:10 pmselinap.com:
I design it myself.
August 18, 2008, 4:44 pmselinap.com:
Jeff: It is not the matter why we should hide the affiliate links. What important is that we could do it.
August 18, 2008, 4:46 pmhanep:
Jeff: what would you do if you found the link you’ll be redirect is affiliate link?. that’s the answer for your question.
i don’t remember the name, but there’s a wordpress plugin that can hide the aff links, and it works.
August 19, 2008, 2:02 amsyuxx:
i always use iframe to cloak my affliate link. then i encrypt the code so when they view the source, all they see is just the code.
August 23, 2008, 7:59 pmHow to hide your Affiliate Link | Thumlog!:
[...] also has write a nice tutorial on How to Hide affiliate link. You might be interested to read the 9 ways to hide affiliate links tutorial by Selinap. Subscribe to comments Comment | Trackback | Post Tags: affiliate program, [...]
September 1, 2008, 9:15 amhtaccess redirect:
Don’t forget to mention that PHP redirectional scripts work just has good as actual redirect codes.
September 10, 2008, 9:56 pm