Everytime we make a post on our websites we generally have a link to some othersite, usually an affiliate link.
Just this morning, I was updating and old ebook of mine on how people can buy high page rank domains for just $5, and I wanted to redirect them through my affiliate link.
The affiliate link is the usual CJ (commission junction) links, in other words is long and contains lots of numbers and dashes.
So I wanted to put a link that went directly to the other site.
So, lets say we want to make a redirect on this site to Godaddy, using my affiliate link.
So if sometime types in http://www.websitesecrets101.com/godaddy they get sent to godaddy.com with my affiliate code in place.
So , how do we do it.
Its easy to do, all you have to do is open up your websites .htaccess file (please note this approach does not work on Windows servers), with your favourite text editor. Notepad works just fine!
Mine looks like this :
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Its the standard WordPress .htaccess file.
No I want to make a redirect that goes directly to the affiliate site. Lets say, for this example, I want to redirect them to Goddady. It may not be your most favorite registar but lets just se it for this example.
So using the above .htaccess file, I’ll edit so that it now include the line
Redirect 301 /godaddy http://www.tkqlhce.com/click-3340454-10419685
The 301 part, means that its a permant redirect, you can use 301 or 302 here.
The /godaddy bit is the path used on this website.
The http://www.tkqlhce.com/click-3340454-10419685 is the affiliate link I will send them to.
So now the full .htaccess file is :
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
Redirect 301 /godaddy http://www.tkqlhce.com/click-3340454-10419685
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
See how I put it just after the “RewriteBase /” line? That means it will redirect without effecting your wordpress install.
So its pretty easy to make redirects by simply modifing your .htaccess file.
[bhtweetthis]Tags: .htaccess, affiliate, affiliate links, apache, links
Thanks for this blogpost. I was having problems getting my affiliate links to redirect previously. Thanks again. Now everything is working fine.
Glad it help
Bruce
Hi Bruce,
Happy New Year & Thanks.
;o)
I was also struggling with that piece of code but now I made 3 tests:
Redirect 301 /go/GoogleSE http://www.Google.se
Redirect 301 /GoogleGR http://www.Google.gr
Redirect 301 /Google-DE http://www.Google.de
& all of them worked fine!
I am very happy as in 2010 all my affiliate links will look much professional & contain my IDs.
Now its time to update all my links on my new WP site…
Thx again & Happy New Year!
Arthur.
This is a useful information.
But I am wondering what I am
going to do if I am redirecting
a lot of affiliate links in a
blog post for instance?
I will need clarification on this
ExpertOse
I never knew about putting your redirects after the RewriteBase / – I’ve used this technique a lot and never seemed to have a problem with it when all my redirects were listed at the bottom of the file, after all the WordPress stuff.
Would you recommend this method if you had, say, hundreds of affiliate links, and if so, then how might you organize everything?
Thanks
Mitch
Godaddy.com coupons list. Almost all of the recurring Godaddy coupons have changed. Here are the official coupons that are all working. These coupons will be working in 2010. $7.49 Domain names and renewals – Use Go Daddy coupons GOO3, OK9, or ZINE10. 25% discount on orders of $100+ – Use Go Daddy promo code OK25. 30% Discount when you buy any com domain – Use Go Daddy coupon code OK30. $12.99 SSL Certificates – Use Godaddy.com coupon codes GOOSSL, OKSSL, or ZINESSL. Hosting Plan Discount – 20% Off Hosting – Use Go Daddy coupons OK20H, ZINE20H1 or GOO20H. 10% off any size order – Use Godaddy.com promo codes OK7, GOO1 or ZINE8. $5 Off $30 or More – Use Godaddy coupons GOO2 or ZINE9. 20% Off Any order of $50 or more – Use Go Daddy coupon OK8.
Hi,
I just wonder if its better to do a 302 redirect than a 301? I have heard you dont pass any value to redirect site if you use 302?