Talking about redirects could quickly become very technical and quite boring but I will limit myself to the basics – why you would want/need to use a redirect and what you need to consider once you do use a redirect.
There are many instances where you might like to use a redirect – refreshing a page, transferring from one domain to another (e.g. from
www.mydomain.com or from
www.mydomain.COM etc.), if you move pages due to a site re-design, etc. This last one is very important and all too often overlooked.
So, why should you bother telling people that pages have moved? And why do you care HOW you achieve the redirect? Well, the point of having a site is to have site traffic, right? Assume you redesign your site, move certain files or even just change the naming convention (for example you might move from static files to a database oriented setup so that
www.mydomain.com/articles.php?id=1. Using redirects can easily and seamlessly move visitors to the old site pages to the new ones.
Two main redirect issues to consider are: how redirects affect search engines and how they affect people linking to you.
For the purposes of search engines, there are two types of redirects that should be used, the “301 permanent” and the “302 temporary”. The number is used to tell search engine spiders (or browsers) that the file being looked for has been moved, temporarily if using a 302 and permanently if using a 301.
This means that when you are planning to move files on your server, you need to correctly inform the search engine spider where and what type of move this was. The wrong information can lead to being dropped entirely or just in ranking by search engines.
Hopefully it doesn’t need to be said, but it is quite important to use the appropriate type of redirect – in other words, using a 302 when you should use a 301 will get you in trouble. By using the wrong redirect, in this case a 302, Google and others can construe this as spamming because of duplicate content issues. A WebProNews article by Shari Thurow, “Duplicate content in the search engines,” explains this issue very well. According to Shari, if you are going to be managing multiple domain names for one website, “always place a 301 redirect on the domains that you do not wish to promote in the search engines.”
Redirects vs. Rewrites
While a redirect actually forwards a browser/spider to a different page, a URL rewrite takes a page in one format (say http://www.domain.com/articles/title/) and loads an alternative page (say http://www.domain.com/index.php?page=articles&title=title) without the client being aware of what is going on. A common use of URL rewriting is when you use a database-driven website and would like to use readable URLs rather than complex query string URLS.
Accomplishing the Redirect
There are a few methods that can be utilized when trying to implement a 301 redirect properly.