Sign up ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have a VPS with and a domain from different hosters. I would like to know about the best practices for setting up the redirects regarding SEO as I am really confused about the different options.

I want everyone who access to be redirected to without having a negative impact on my SEO and I want my site to be displayed as in the SERPS.

As far as I can tell I have the following options:

Option 1 (An A record and a CNAME, no redirects)

DNS Level A record pointing at the IP of my server CNAME to

Server Level
no redirects

Option 2 (Two A records, no redirects)

DNS Level A record pointing to my server A record pointing to my server

Server Level
no redirects

Option 3 (301 Redirect using either of the above)

I can redirect the domain to www.example com via htaccess. Is there any difference SEO-wise based on how I set up the DNS in this case?

Also, what do you think is the best option (or is there a better one I'm missing??

share|improve this question

migrated from May 24 '12 at 20:36

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

2 Answers 2

up vote 1 down vote accepted

Everyone has their favorite way of doing this, so long as it's a 301 it's fine, all the methods you've shown are valid. Beyond using a 301 there is no real best practice because everyone's setup is different.

This is mine, using .htaccess

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

It's a positive compare, basically, if the domain is NOT it redirects to with a 301.

No messing with DNS, no matter what domain the user/bot uses to visit the site they will always end up at It's bulletproof, works with search engines, and you can add new domains without changing any settings.

share|improve this answer
Thanks for your just to make sure: Even if I were to set up 2 a records, both pointing to my static ip, Google would not regard that as duplicate content sites (assuming that I redirect to via 301) – Socrates May 24 '12 at 22:15
@Socrates So long as there is one primary domain and the other is a 301 redirect, then no. All paths should lead to Rome. – toomanyairmiles May 24 '12 at 23:02

In my experience, using the .htaccess method works great without any noticeable effect on search engine ranking. That said, it would be a very good idea to find any sites linking to you using the non-www version and ask them to change it to the www version.

For setting your preferences on the SERP, you can configure this in Google Webmaster Tools. See this article:

share|improve this answer
I know that i can redirect via htaccess but I want to find out which is the preferred method (also regarding my DNS setup) in order to avoid duplicate content. – Socrates May 24 '12 at 21:11
To my understanding, using the .htaccess method is the preferred way of forcing the use of the www-version of your site, along with doing your best to have all internal and external links pointing to the correct URLs. I do not know of any advantages or disadvantages of using either DNS method to get them to your site, aside from using the CNAME to not have to modify the IP address twice if it changes. – Daniel Hirsch May 24 '12 at 21:54

Your Answer


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

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