I have set up my website from the beginning to be used without the www, ie 'naked', with the following command at .htaccess and everything is working fine.

RewriteCond %{HTTP_HOST} ^www\.soeezauto\.ma [NC]
RewriteRule ^(.*) http://soeezauto.ma/ [R=301,L]

Now, I have placed the website on Cloudflare for optimization reasons and it seems that they are only able to handle www domains ( if you come through a partner host, which is my case ), so I need to change my domain to work as www.example.com

My main concerns are:

  • Losing HISTORICAL DATA on Analytics/Webmaster
  • Make sure all the web pages I have out there without www will show normally when I change to www.example.com

This is what I found so far:

  • In Google Webmaster Tools -> Website settings -> Favorite domains, it is marked as not defined, meaning neither example.com nor www.example.com are selected. So, should I leave as is or should I choose www.example.com? Or is it something else I should do?

  • In Google Analytics I found this article. Is it fine to do like that?

  • In .htaccess

    RewriteCond %{HTTP_HOST} ^.example.com [NC] RewriteRule ^(.*) http://www.example.com/ [R=301,L]

Also, I read in this question, that I should REDIRECT ALL OF MY WEB PAGES to WWW via .htaccess. Is that the case? I have about 4000 pages out there. It will slow the server down quite a lot I believe to have such a huge .htaccess.

Will that work? Last thing I want is to mess this up and lose data/indexation, not to mention have the site inaccessible to my visitors.


1 Answer 1


Will you lose SEO value?
301-headers will transfer all* SEO value from the naked version to the www version, you have nothing to worry about, as long as the pages keep existing (which should be the case if you only switch to www.). Don't forget sitemaps, and other XML files which might contain your domain.

* I've read about loosing the tiniest bit due to a redirect, but cant find documents about that.

Will my server slow down (with 4000 pages)?
Theoretically? Yes. Noticeable? I doubt it. .htaccess is really really fast, you should not worry about this. Besides, after an X amount of time all pages will be index as www, so the need for redirect becomes less and less (until it's only needed for the users why directly type you URL, without www).

# Some example code. ALL pages will be redirected properly,
# No need for individual redirects
# No need for the actual domain name, hard code as little as possible
RewriteCond %{HTTP_HOST} !^www [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

The Google tools/sites
You're gonna have to set all preferred's to the www. version.
Do you really need a new code? IMO not really. I did this when I switched from HTTP to HTTPS, it confused me a heck of a lot more then it helped, resulting in weird verification problems.
Looking back, I wish I stayed with 1 code, loosing my history wasn't worth "doing it right" (again, IMO).

  • Thanks Martijn. Just to be sure: You are saying that I do need to have all the 4000 webpages redirected, not only at the domain level, right?
    – BernardA
    Commented Dec 1, 2014 at 11:41
  • No. Just use 1 line to redirect everything to www. I'll update my asnwer
    – Martijn
    Commented Dec 1, 2014 at 11:48
  • Ok, I have done it. Let's see what happens with indexing. Thanks again.
    – BernardA
    Commented Dec 1, 2014 at 15:39

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.