Question

I added cloudflare to my domain and after that I can't get my code in .htaccess work. I had code that deleted extensions. Example: site.com/link.html --> site.com/link

This is the code from .htaccess

# Use PHP5.4 as default
AddHandler application/x-httpd-php54 .php

# Start CloudFlare:tramvaj.info rewrite. Do not Edit 
RewriteEngine On 
RewriteCond %{HTTP_HOST} ^mysite.info 
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] 
# End CloudFlare rewrite. 

RewriteBase /
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html

Can somebody please help me?

Was it helpful?

Solution

Ok can you try this:

AddHandler application/x-httpd-php54 .php
RewriteEngine On 
RewriteBase /

# Start CloudFlare:tramvaj.info rewrite. Do not Edit 
RewriteCond %{HTTP_HOST} ^mysite.info 
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE] 
# End CloudFlare rewrite. 

RewriteCond %{REQUEST_FILENAME} !-f    
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.+?)/?$ $1.html [L]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top