Http:example - www.example

Just noticed in my webmaster tool account that two of my sites has been added again but this time without the www. prefix. And when I go the url, my complete is site is shown without the www. prefix. Should I be worried? And how can I change it back to how it used to be so that when you go too the site without www. you will be redirected… so it wont be considered duplicate content?


Put this in your .htaccess file (assuming you’re using Apache):

RewriteEngine On
RewriteCond %{HTTP_HOST} ^$ [NC]
RewriteRule ^(.*)$$1 [R=301,L]

Obviously, replace with your actual site address.

You need to escape the . in the RewriteCond, and there is a slightly more optimized version of that code:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain\\.com$ [NC]
RewriteRule .?{REQUEST_URI} [R=301,L]


thanks stevie and scallio for the help!, just one more dumb question my site is with hostgator on cpanel will this code work with that?


Certainly should do - CPanel runs on Apache hosts, and that is what this code is designed for.

awesome, thanks stevie!

I think with www is best for SEO

[ot]Am I the only one reminded of the scene:
PHB: “I think we should build a database”
Dilbert: “What color do you want that database?”
PHB: “I think mauve has the most RAM”[/ot]

Why? I’ll give you a clue - it makes absolutely no difference, as long as you are consistent throughout the site and off-page SEO, and you have appropriate redirects in place. You might as well say that using Verdana improves your SEO.

I think with www is best for SEO

Any one know any thing about this, i personally dont think so but want to make sure

As I said in the post above yours, it’s absolute rubbish.

its no need to care about a naked domain or a prefixed one !
in seo content is king :slight_smile: