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

Possible Duplicate:
Does the “canonical name” in DNS make any difference to search engines?

Mu understanding is that CNAME should be used for subdomains and www is just another subdomain. Of course I could do a 301 redirect but it seems odd to do that when I've got it working now and I'm an apache noob so I rather wouldn't mess with it.

share|improve this question

migrated from serverfault.com Mar 20 '12 at 3:30

This question came from our site for professional system and network administrators.

marked as duplicate by John Conde Mar 20 '12 at 10:33

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

add comment

1 Answer 1

up vote 3 down vote accepted

If you set example.com and www.example.com to the same IP address (www is a CNAME of @) then it depends how you have it configured on the server. You should NEVER have a website load for both the naked domain AND the www subdomain. I would personally pick which you want to run the site on: www or naked domain. If you want to run it on www, go to http://wwwizer.com and then copy the IP (174.129.25.170) and set it as the A-record for the naked domain, then set your www-subdomain to the IP of YOUR server. This pops a 301 redirect for anyone accessing your naked domain. If you want to REMOVE the www, and make all users use the naked domain, you will need to do some server-side config:

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

You can pop that into a .htaccess or into the httpd.conf or wherever your Apache config files are. (Be sure to restart Apache if you change anything).

For SEO purposes, see here: http://www.toxzen.co.za/tutorials/item/50-to-www-or-not-to-www-that-is-an-seo-question

It's essential to use a 301 redirect either to add or remove the www. You have to choose one, and must stick with it. "It doesn't matter which you choose but you should pick one and be consistent ... So whichever you choose for aesthetic reasons should be consistently used for SEO reasons"

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.