How to Set Up 301 Redirect
You may know about using html meta redirects to protect your affiliate links. Today let's talk about our favorite way to redirect affiliate links
Here’s how to set up 301 redirects.
What Do You Use 301 Redirects For?
There are a couple of different reasons why you may want to set up these redirects.
1) To Cloak Affiliate Links
We already mentioned that we like to use this method for cloaking affiliate links. The links look prettier and you don’t have to worry about stolen commissions as much.
2) To Permanently Move A Page
The second main reason why you may need to set up a 301 redirect is to permanently move a page. For example, let’s say that you started your website as a static site and had a page named example.html . You’re moving your site to WordPress and suddenly the url for that same content becomes /example .
In this case you should set up a 301 redirect so your links don’t break and to redirect any and all link juice that the original page had to the new page.
How To Set Up A 301 Redirect
Setting up a 301 redirect may sound a bit intimidating at first, but it really isn’t all that hard. Here’s how to do it.
You will need to edit your .htaccess file. To find it log into your webserver. You can do this via an ftp tool like Filezilla or if you have Cpanel hosting, log into your cpanel account, and then click on the file manager. Either way, you’ll most likely find a file in there named .htaccess.
If you don’t, open a blank notepad document and save it as .htaccess (not that the filename is blank and the extension is .htaccess).
Take this open notepad document or open the existing .htaccess file from your server with notepad and add a line of code to set up the 301 redirect.
I’ll show you an example of the code and then we’ll go over what each part means.
redirect 301 /example.html https://www.piggymakesbank.com/example/
“redirect 301″ simply tells the browser that this is a permanent move of a file. There is also a temporary 302 redirect, but I recommend you don’t use it.
“/example.html” is the file location of the old or original file.
“https://www.piggymakesbank.com/example/” is the destination of the new location. It’s important to use a full link here including the http .
Once you have typed in your code, save the document and load it back up to your server.
Last but not least, test your redirect by going to the location of the old page. In this example I would type www.piggymakesbank.com/example.html into my web browser. If it takes me to https://www.piggybanksbank.com/example/ I know the redirect is working and I’m all done.