Please Login or Register

Portal Home > Knowledgebase > CloudFlare > How to use CloudFlare on root domain (without www)


How to use CloudFlare on root domain (without www)




Because CloudFlare works through CNAMEs, CloudFlare cannot be enabled on the root domain, which is an A record. If you would like to use CloudFlare to accelerate and protect traffic going to the root domain, you must add a redirect in the .htaccess file to 'www'.  The "root" domain would be http://mydomain.com instead of http://www.mydomain.com 

As a reference, here is one example:

RewriteEngine On
# Rewrite added for CloudflareInstall - mysite.com
RewriteCond %{HTTP_HOST} ^mysite.com$ [NC]
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^(.*)$ http://www.mysite.com/$1 [R=301,L]


Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article