If you are not using 301 Redirects you are making a blogging mistake. 301 Redirects are easy to setup, save your google pagerank and link love, and save your visitors from a nasty “Error 404 – Not Found” page. What is a 301 redirect? It’s a single line you add to you “.htaccess” file (more on this later) that says ‘anyone that visits that URL – send them to that URL instead’. The redirect can happen witin your site, you can redirect to an external site – it’s basically from any URL to any URL.

Here’s a bloggers guide to some scenarios where you would use a 301 redirect:

  1. You’ve changed your permalink structure
  2. You’ve accidentally deleted a post and need to recreate it
  3. You wish to change the post slug (url) to make it more seo friendly
  4. You have a bunch of 404’s for pages that don’t (and maybe never) existed
  5. You recently moved from one blogging platform to another (drupal, blogger, movable type, etc., to wordpress)
  6. You changed, recreated, or renamed your categories

If you’re using WordPress, you can try and install a module to add redirects directly from your admin panel. I personally have not had luck with this plugin, but some have – you’re welcome to try the Objection Redirection WordPress 301 Redirect Plugin and see if it works for you.

If it doesn’t (or if you’re not using WordPress), you’ll need to edit your .htaccess file yourself. If using WordPress, you should already have a file called “.htaccess” in the root of your web site. If not, you’ll need to create it. Open up any text editor (notepad) on your PC. You’ll need an FTP account and FTP access to your web site to do this. If using WordPress, download your .htaccess file. It should already look something like this:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

If you’re not using WordPress, download your .htaccess file and open it (or create a new one if you don’t have one already). Basically – you’re going to add one line for each redirect. It’s very simple:

Redirect 301 “/blog” http://www.yourwebsite.com
Redirect 301 “/page.html” http://www.yourwebsite.com/page.html
Redirect 301 “/subdir/oldpage.html” http://www.yourwebsite.com/subdir
Redirect 301 “/blog” http://www.anotherwebsite.com

I tried several ways to do this, and this is the one that works for me every time. I’m hosted on a Linux server running Apache. Every line starts with “Redirect 301 “. Then (always in quotes) is the path on your server to redirect. I always start it with a slash (that means from the root of your site). There is no need to write out your full domain name in the first part. You can redirect a directory, a page, a page in a sub-directory, etc. Then just write the full URL to the page you are redirecting to. You can redirect to a page in your site, a sub-directory, or a page in a sub-directory. You can even redirect from your site to another (external) web site.

That’s it! Save you file and FTP back to the root of your web site and you’re done!

The reason I had to setup some 301 Redirects is because I migrated one of my web sites from Drupal to WordPress. With the date based permalink structure in WordPress, the URL’s of all of my important pages with pagerank was screwed up. They say if you redirect a page that had google page rank (to a new page) the (old) page rank will be passed on to the new page. I can’t verify this myself, because my redirects haven’t been in place long enough to tell. I will update after they’ve been online awhile.