
Broken links can cost you valuable linkjuice, PageRank and traffic...not to mention loyalty.
After seeing the lost link juice / lost traffic issue play out in one project after another where someone else takes the reigns and chaos ensues during site redesigns and hosting change-ups, this is one technical SEO topic I just simply had to revisit on SEMinsider. There is one simple tool that would empower so many site owners to take control of their sites’ PageRank and rankings–if they only knew about it: the hard-working 301 redirect.
There are several ways to execute a 301 redirect, but for redirects, it’s usually best to go old-school and skip the control panel solutions your host may have offered. Does that sound like the opposite of easy? Here’s why I recommend it…
Control panels assume the user fully knows the ramifications and limitations they present to the user. Professional webmasters and developers who deal with more technical issues on a regular basis learn what the control panel can and can’t do and how. It can be easier for them to do tasks that way since the panel will generate whatever they need if they know where to go. If your control panel is anything like my host’s, however, it’s better to go straight for the .htaccess method to create the right 301 (permanent) redirects that you actually need. The reason? Well, it allows more freedom of control.
There are actually several different ways to do a permanent redirect. The following way utilizes the .htaccess method and is generally the safest way to go. As in anything else, however, the golden rule is to avoid any kind of redirect whose sole goal is to present one kind of content to a search engine and another to the user. Since we’re not trying to do that here, don’t worry–this is all legal and white hat SEO.
Once you get started creating or editing your site’s .htaccess file, you will find it more than a little addictive. I don’t know about you, but just tinkering with mine from time to time gets me in the mood to set new permissions and review any pages that should be redirected, any image folders that should be blocked from hot-linking, etc. By directly creating and editing your own .htaccess files on your site’s directory, you can see and think more clearly about what redirects you should really be using on your site. After you’re done reading this post, you’ll finally understand a little about .htaccess files and actually know how to create redirects on the fly like a pro webmaster (using the provided model until you get the hang of it, of course).
[3/27/2010 Update: I decided to restrict the focus of this post to a general situation where the user is wanting to redirect permanently from an old URL on the site to another one, wherever it may happen to be. This keeps things simple for purposes of this post. Other posts will be named Part 2, and so on...]
STEP 1
Check your directory root. If you already have one there, make a backup copy on your hard drive and you might email yourself a copy just to be safe. If you don’t currently have a .htaccess file, follow the model below (you may copy and paste the code snippet and insert your OWN directory/file names, just keep the spacing the same as you see here):
Redirecting from one directory or file to another directory or file
Syntax: Redirect permanent [/old URL][space][fullnewURLgoeshere]
Ready…here’s the base version of the code:
Redirect permanent /optionaldirectoryhere/oldfilename.html /http://www.somewebsiteurlgoeshere.com/optionaldirectopry/thenewurlhere.html
Got that? Now maybe you can see the clear-cut roles of the space ” ” and the forward slash “/” in the example lines. Process that and the language of “Redirect permanent” and you already have a working understanding of the syntax of the code involved. Pretty simple, isn’t it? Now let’s move on…
STEP 2:
Remember to replace the file or directory names with actual ones. Four examples were given to allow for different possibilities that might arise. Otherwise this code is good to go. No other tags are needed.
You can always use this model and just delete the page file at the end. This will move one directory’s contents to another directory on the same site or to another one if desired. If you need to move an entire folder of your site, or just a page, now you have a method to safely move them without the loss of inbound link juice and/or traffic.
Stay posted for more examples of how to use .htaccess files to empower your control over your sites.