2

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?

1 Answer 1

1

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.

1
  • +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, 2011 at 14:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.