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

I have example.com, which points to web server using A records, I want to redirect all traffic from www.example.com to example.com.

As far as i know these are methods,

  1. 301 HTML redirect from www to example.com
  2. Add CNAME alias for www to @
  3. Add A record for www to webserver IP

What is the best way to do it without affecting my search engine ranking?

share|improve this question
add comment

3 Answers

up vote 4 down vote accepted

The 301 redirect is what you want to use if SEO is your primary concern. The 301 redirect will not only tell the search engines your pages have moved (assuming you are currently using both the www and non-www versions of your pages) but also help them associate the old URLs with the new URLs. This means any links you have to your old pages will count towards your new pages. They do lose a little bit of value because of the redirect but that's better not not doing it at all.

See this answer for more info on 301 redirects and www/non-www

share|improve this answer
    
thanks John, I will use 301 redirect –  Riyaz Mohammed Ibrahim Apr 5 '11 at 4:03
add comment

One thing to keep in mind is that DNS does not provide a redirect - adding an A or CNAME record will only provide your IP address to people that type in that URL. If you only add one of these two records, www.example.com and example.com would both resolve to your web server, essentially giving each page on your site two addresses and potentially wreaking havoc with any statistics you're keeping.

You would have to set up an additional 301 redirect, via server-side redirects or the HTML redirects you were mentioning, before visitors would always be redirected to use the example.com version of your site.

share|improve this answer
add comment

I think you can use 301/302 redirect to point your users to the intended destination, its the best option for redirect your users.

share|improve this answer
add comment

Your Answer

 
discard

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.