DNS records, www, and redirects, performance and SEO
- SEO |
I am in the middle of setting up a website, and am trying to make sure I the basic setup right from the beginning. Hopefully someone webhosting savvy can chime in if what I have done is right.
The problem/question is related basically to a simple issue I was having where the "www" was not appearing in the domain name. For example, www.domain.com would go to domain.com. Not that it technically matters, I suppose, but it seems as if people trust the www, and I also want to make sure both addresses appear and function as the same site to both people and Google.
In any case, the first thing I did was make sure all subdomains (including www.) exist and point to the IP via A records. So:
domain.com A IP
www.domain.com A IP
mail.domain.com A IP
...
From what I understand, using ONLY A records is preferable from a performance standpoint relative to some subdomains using CNAME records (e.g., using CNAME to map the www to the non-www). Is this correct?
The second thing I did was modify my htaccess file to create a permanent (301) redirect to the www version:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(www\.)?domain\.com$
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L,NC]
Does this syntax look right?
At this point, things do function as expected. However, I want to make sure that everything I have done is correct and best way to do it?
Any comments would be greatly appreciated. Thanks.
ChimpRewriter - The world's smartest and most powerful article rewriter - FREE 7 day trial
Join hundreds of affiliates averaging $2.50 / click plus recurring commissions