Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have http://www.example.com/article

Due to rampant content development by authors in my site, http://example.com/article has also been widely indexed by Google.

Now, both are there roughly in equal numbers in Google search result.

So, the total page rank for the corresponding keywords is shared between the two URLs.

I want only http://www.example.com/article to be indexed and have all the page rank value that it deserves.

Will doing a 301 redirect from http://example.com/article to http://www.example.com/article achieve it? If not, what else should I do?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

What you want to do is a 301 redirect from example.com/anypage to www.example.com/anypage. Basically you just want to add the www, not take the user to the home page just because they forgot the www. That's really bad usability.

Fortunately this is easy to do if you use Apache. This little snippet in the conf file for the site or a .htaccess will do the trick:

Options +FollowSymlinks
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(www\.|$) [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

This will make sure that PageRank and each page's ranking (two different things) are maximized and focused on the page with the www. The page without the www will eventually fall out of Google's index.

share|improve this answer
    
+1 your solution is more elegant as it doesn't have a hard coded domain name. I was expecting one in the syntax. Great! –  user5413 May 16 '11 at 14:20
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.