16

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?

3 Answers 3

7

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.

5

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

0
0

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

Your Answer

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

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