The aim of this post is to explain 301 redirects in their simplest form so that anyone with a website who has heard of a redirect is able to understand and implement a 301 redirect on a site.
What is a 301 Redirect?
A 301 redirect is a permanent redirect from one URL to another. This type of redirect is used to preserve the link equity which was built up from the original URL so that it can be passed on to the new URL. This should help to keep the original search engine ranking of the URL too.
When a 301 redirect is implemented on a URL, the main aim is to help the site visitor to find the newest and most relevant information.
When should you use a 301 Redirect?
- If you have built a new website and it is using a new URL, then you want to help people to find the new website by redirecting them to the new site via the old URL.
- If your site is accessed via lots of different URL’s, e.g. – people use www.yoursite.com/home, yoursite.com and www.yoursite.com – it’s a good idea to point them all to one centralised (preferred) page
- If you have 2 websites and you want to merge them together it is advised that you redirect the old URL’s to the correct pages
.htaccess 301 Redirect
The easiest and quickest way to 301 redirect a page is via the .htaccess file.
1 – To start off with you want to check your server to see if a .htaccess already exists, if so, download it to your computer so that you can edit it. It’s a good idea to make a copy of this file so that if anything were to go wrong, you can delete the file you created and upload the original .htaccess file
2 – If there is no .htaccess file present on the server you can easily create your own. Open Notepad and save the file as .htaccess
3 – Add the following code to the file (replace with your own URL’s)
Redirect 301 /old http://www.yoursite.com/new
4 – If you downloaded the .htaccess file from the server and it already had some code, simply skip a line and then add the code in point 3.
5 – Save the file- remember to keep the file names as .htaccess
6 – Upload the .htaccess file to the root folder of your server. If there was a .htaccess file present before then you’ll probably be prompted to overwrite the existing file, which is fine.
7 – Test to make sure your redirect was successful by typing in the original URL and you should arrive at the new URL.