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
<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
<?php header("Location: http://your-affiliate-link-goes-here"); ?>
ASP redirect
<%@ Language=VBScript %>
<% Response.AddHeader "Location","http://your-affiliate-link-goes-here" %>
ASP.NET redirect
<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
Response.AddHeader("Location","http://your-affiliate-link-goes-here");
}
</script>
Coldfusion redirect
<.cfheader name="Location" value="http://your-affiliate-link-goes-here">
JSP redirect
<% response.setHeader( "Location", "http://your-affiliate-link-goes-here" );
response.setHeader( "Connection", "close" ); %>
cgi Perl redirect
$q = new CGI; print $q->redirect("http://your-affiliate-link-goes-here");
Ruby on Rails redirect
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.
RewriteEngine on RewriteRule ^affliate.php$
http://your-affiliate-link-goes-here [R]