July 6, 2010 / admin

You, my friend, must stretch the boundaries of your imagination and put yourself in the shoes of a web developer. You have been contracted to redesign Bob “The Sniper” Houlihan’s surprisingly popular History of Shoelaces site. During this process, you’re revamping his page titles, URLs, and overall site structure. Bob doesn’t want to lose his current place in search engine rankings in exchange for the long term success and usability improvements that you promise.

Fast forward a couple months and the site is ready to go live. You have the name server repointed to the new location. Everything works great… but you’re not done. It’s time for 301 redirects. 301s just tell the browser that what you’re looking for isn’t here, but it has moved to this other specified location. If you’re on Apache and able to use an .htaccess file, this is what a 301 redirect will look like:


redirect 301 /Before_Shoes.html http://www.thehistoryofshoelaces.biz/before-shoes

This tells the server that if Before_Shoes.html is requested by the browser, send them to http://www.thehistoryofshoelaces.biz/before-shoes instead. The most obvious reason to do this is so your site doesn’t serve up a 404 error. The user could possibly think that the site is down permanently. Any pages that are renamed, relocated, or content that is moved needs to be taken into consideration when creating 301s.

But, it’s not only people using the internet. There are also bots used by search engines. The 301 part speaks to them directly, saying this page has been permanently moved (not temporarily, that’s important and covered later). This helps new/moved pages to be indexed more quickly, get those old URLs replaced in the index, and maintain your page rank within the search engine.

But why 301 of all numbers? That, my friend, relates to the ubiquitous but little understood HTTP. Part of HTTP’s job is to serve up status codes when responding to a request which can be as simple as typing in a web address in your browser. Part of this response is the status code. Each status code is a three-digit number beginning with any number from 1 to 5 with 1 representing Informational responses, 2 a success, 3 redirection, 4 a client error, and 5 a server error. You’ve probably seen “500 Internal Server Error” or “404 Not Found.” You probably haven’t seen a 302 code which is a temporary redirect telling bots that the page will likely reappear at a later date. 301 redirects do not provide this likelihood. Go here [link to complete list] for a complete list.

Posted In: Blog, Programming