301 Redirects: Only One Home Page Please



Configuring a domain on a web server is a fairly easy task. It does not matter if you are on IIS, Apache or some other flavor of server software, setting up a domain is rather simple. You pick a folder where the content resides, give the domain a name and assign an IP (static or otherwise). Yes this is simplified, but that is basically it. However, the default site settings for most servers can give you some SEO headaches if you are not careful. Here’s an example, if you type in www.mydomain.com you should see your homepage. Now if you type in mydomain.com without the www you should still see the home page. Good. The problem comes in the address bar. Go look. If your home page still shows mydomain.com in the address bar without the www and you are seeing your homepage, you have issues.

Search Engine spiders read URLs very literally. So if there is any change in the URL it is considered a different page. Let’s expand on the example:

http://www.mydomain.com
http://mydomain.com
http://www.mydomain.com/index.html
http://mydomain.com/index.html
http://www.mydomain.com/index.htm
http://mydomain.com/index.htm
http://www.mydomain.com/default.asp
http://mydomain.com/default.asp

In practice, each of these URLs shows the same page. In practice, search engines see each of these as different pages since the URLs are different. So without some fixes, you now have 8 duplicate pages on your site. Now to be fair these pages wont automatically be indexed and considered duplicates, first there needs to be a link to your site or from within your site using one of the URL versions. Since you don’t know how other people might build the links to your site, you need to be proactive and prepare for the possibility that these URLs will show up.

The preferred URL for a homepage is www.mydomain.com. But you don’t have to select this as you’re preferred format. What you do need to do it to make sure every variation of the URL ends up pointing to your preference.

The first step in doing this is simple. Make sure every link on your site to the homepage uses the same URL structure. I strongly recommend using www and pointing to the root of your domain; www.mydomain.com. This way if you ever have to rename the homepage file at the root, it will not effect your current SE indexing. Renaming may happen if you switch to a dynamic site and now all your pages are now php instead of html for example.

Now about those variations. You are going to need to set up 301 redirects for those extra URLs. There are a number of ways to do redirects, but using a 301 redirect is the ONLY safe way to do it for SEO purposes. Any kind of javascript or meta redirect could get you in trouble. There are other forms of redirect as well, a 302 redirect would provide the proper function, but it is interpreted by engines as only a temporary redirect. Not good.

Implementing the 301 redirect is different depending on which web server you are using. If you are on Apache running under Unix or Linux you can add the 301 redirects via your htaccess file. If you are not sure what your htaccess file is read some of the results from this search. If you are familiar with htaccess, here is the base code you can modify to meet your needs. Just add to file and modify as needed.

# Turn on rewrite
Options +FollowSymlinks
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\.yoursite\.com [NC]
RewriteRule ^(.*)$ http://www.yoursite.com/$1 [R=301,L]

If you are running IIS it’s going to be a bit more difficult. You can either use ISAPI and create the relationships yourself, or write a piece of code in PHP, ASP or .net depending on what you are using. The details of how to do these are a bit more than I had planned for this article but be sure if you Google it, plenty of people have already written how-to articles on the subject.

To sum up, you need to make sure that any URL which would normally show your homepage content is the same no matter how it is linked or what is typed in the browser. If there are variations, you leave yourself open to the possibility of have duplicate pages indexed by the search engines. Duplicate pages can be a major issue for some search engines and are something to do your best to avoid.


Article Permalink
http://www.appliedseo.com/archives/seo-tech-only-one-home-page-please/
Article Trackback Link
http://www.appliedseo.com/archives/seo-tech-only-one-home-page-please/trackback/

Information and Links

Join the fray by commenting, tracking what others have to say, or linking to it from your blog.


Other Articles
Improving your Content to Code Ratio
Real World SEO Case Studies

Write a Comment

Take a moment to comment and tell us what you think. Some basic HTML is allowed for formatting.

Reader Comments

good info! thanks.

how about sub domains? i have a client who insists on using “www” on all their web sites, even if it’s a subdomain. so far, i just recommended using both but after reading your article, i’ll make sure that we are consistent. is there any argument against using http://www.subdomain.domain.com?

Hi pirco,

That is a very good question and you answered it yourself. :) Consistency is the key. However, keep in mind that you don’t always have control over how other sites link to yours so implementing the 301 redirect is still a must. http://www. is just another sub domain, it just happens to be the standard default. When you do http://www.subdomain.domain.com, what you are really doing is sub-subdomain.subdomain.domain.com.

The 301 redirect in this case is all about preventing the indexing of duplicate pages by allowing multiple URLs to display the same content; no matter what the URL or sub sub domain.