500 Internal Server Error After Enabling ClouldFlare on Hostgator

CloudFlare is known as the cloud-based service caching site content on proxy servers around the world. Its main objectives are protecting your site from malicious threats and improving website performance, all of those great features are provided for free. CloudFlare is being used widely by many bloggers and there are many positive reviews about the service. Some has seen a dramatic increase in loading speed, more visits and lower bounce rate on their sites.



CloudFlare has been integrated into HostGator and if you are using the hosting service, it will take you less than 1 minute to set it up. Just go to the HostGator’s CPanel and find the CloudFlare icon in the Advanced box. Then you just need to choose your domain and activate the feature. By doing this, you’ve just enabled the Basic Mode of CloudFlare, you even don’t need to change nameservers of your website. However, after I activated CloudFlare in HostGator, I saw the 500 internal server error when trying to access my site.

500-internal-server-error
This is not a problem from CloudFlare, it seems to be a minor bug of HostGator. I checked to find changes they have made and found out that they added some lines to the file .htaccess in the root folder (not the one in public_html). Here are lines they added:
### BEGIN CLOUDFLARE REWRITE (www.tek3d.org)
Rewrite Engine on
RewriteCond %{HTTP_HOST} ^www.tek3d.org$ [NC]
RewriteRule ^(.*)$ http://www.tek3d.org/$1 [R=301,L]
### END CLOUDFLARE REWRITE ####
There is a small mistake in the block and to fix the internal server error, we just need to replace Rewrite Engine on with RewriteEngine on. So, the code block would look like this:
### BEGIN CLOUDFLARE REWRITE (www.tek3d.org)
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.tek3d.org$ [NC]
RewriteRule ^(.*)$ http://www.tek3d.org/$1 [R=301,L]
### END CLOUDFLARE REWRITE ####
I’ve seen some people have the same problem as mine and hopefully this post could be helpful for you.

source
Post a Comment

Subscribe and get updates via email

Enter your email address:

Delivered by FeedBurner