HTTP 301 The Redirect Basics
Often we hear to use a redirect when a webpage is not reachable anymore or a URL is changed. But I thought it might be handy for a lot of people to list the basics of such a redirect.
First of all: When do you use a Redirect?
- As default – this is the preferred method for every page redirection.
(You can also use canonical URL’s but the 301 redirect is the preferred method.)
- For pages that are permanently moved or replaced.
- Domains that are permanently moved (acquisitions, rebranding, etc.).
- 404 pages and expired content (when there is still relevant content or the page still exists).
The most important search engines are cracking down on websites that use sneaky redirects or point multiple domains to the same content, without using a proper redirect. The 301 permanent redirect is therefore also known as a search engine friendly redirect.
The best practice is to create the 301 redirect at the.htaccess file.
This file is located in the HttpDocs folder of your site, you can access this file easily thru an FTP client and edit the file as a text file.
To use the .htaccess file your website has to be on an Apache (Linux, Unix) based server. Here at WA this is the case, so for everybody with their site hosted on WA, this procedure can be applied.
If you use another hosting and you are unsure, then a simple header check will indicate your server type.
You can use this link to do this: http://tools.seobook.com/server-header-checker/
But you can also use your SEO plugin (I think the all in one has this possibility also), for Yoast you do it like this:
How to setup a 301 Redirect
The basic code for redirecting is:
Redirect 301 old_location new_location
You have moved your domain to another site / domain name:
Then you actually want to redirect the whole site, replace, of course, the previoussite and newsite values with the real values.
These 4 lines have to be added in the .htaccess file:
That is about it for the basics, of course, a lot more can be said about this redirection method. But when you understand the above well, then you can go already a long way with this knowledge...
I hope you liked this piece of info... ;-)