1

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 mysite.com to be redirected to www.mysite.com without having a negative impact on my SEO and I want my site to be displayed as www.example.com 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
example.com A record pointing at the IP of my server
www.example.com CNAME to example.com

Server Level
no redirects


Option 2 (Two A records, no redirects)

DNS Level
example.com A record pointing to my server
www.example.com A record pointing to my server

Server Level
no redirects


Option 3 (301 Redirect using either of the above)

I can redirect the example.com 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??

2 Answers 2

1

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 ^(.*)$ http://www.yourdomain.com/$1 [R=301,L]

It's a positive compare, basically, if the domain is NOT www.yourdomain.com it redirects to www.yourdomain.com 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 www.yourdomain.com. It's bulletproof, works with search engines, and you can add new domains without changing any settings.

2
  • Thanks for your explanation..so 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 example.com to www.example.com via 301)
    – Socrates
    Commented May 24, 2012 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. Commented May 24, 2012 at 23:02
1

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: http://support.google.com/webmasters/bin/answer.py?hl=en&answer=44231

2
  • 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
    Commented May 24, 2012 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. Commented May 24, 2012 at 21:54

Your Answer

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

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