Benefits of 301 Redirects and How to Use Them with Apache
by MikeRA common question that I run across is "What is a 301 redirect?" Simply put, it's a way to say that your page(s) have been permanently redirected to another location that you specify. There is a big difference between 301 redirects and 302 redirects. A 302 redirect signifies that your page(s) have temporarily moved. It is my opinion that 302 (temporary) redirects are absolutely pointless and should be avoided. In fact, during the 2007 Las Vegas Pubcon, the entire panel (consisting of Matt Cutts of Google, Tim Mayer of Yahoo, Greg Boser of WebGeurrilla, Danny Sullivan and others) said that there is no good use for 302 redirects ever.
Now that we have established that 301 redirects are the way to go, what are some circumstances that would make you want to use them in the first place? Well, if for instance, you transferred a site from one domain to another, you will want all of your backlinks not turning into 404 File Not Found errors, but instead going to the new domain. Even if you are transferring files around on the same domain, you may want to utilize 301 redirects in order to prevent losing any backlinks you have gotten over time.
In order to perform 301 redirects with Apache, you need to be able to create/modify .htaccess files. As a general rule, I always place my .htaccess files in the document root.
A simple example, you own OldDomain.com, but need to transfer all traffic to NewDomain.com. The process is very simple. Go to the document root on the OldDomain.com server and if a .htaccess file already exists, add the following to it (or create it if it doesn't already exist):
Redirect 301 / http://www.NewDomain.com/
If you need to redirect only a specific directory:
Redirect 301 /directory /new_directory
Or if you need to redirect only a specific file:
Redirect 301 /file.html /new_file.html
As you can tell, the basic syntax is as follows:
Redirect 301 <old> <new>
That's all for this post, folks. Good luck : ).
