0
Options -Indexes
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.html [NC]
RewriteRule ^ %1 [R,L,NC]
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^ %{REQUEST_FILENAME}.html [L]

In my website I am using this .htaccess code to remove .html extensions from url. It works fine in some urls but it gives 403 forbidden error in some urls. I checked file permissions of these urls. Those are ok 0644.

Pal Bora
  • 1
  • 1
  • Are they interfering with actual directories? – Lee Aug 15 '14 at 11:10
  • Without these rules, do the normal files produce a forbidden error too? – Sumurai8 Aug 15 '14 at 11:51
  • possible duplicate of [Trouble removing .html URL extension using .htaccess](http://stackoverflow.com/questions/10676547/trouble-removing-html-url-extension-using-htaccess) – MrTux Aug 16 '14 at 19:03

1 Answers1

0

Answer:

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

Per Trouble removing .html URL extension using .htaccess

joshiki
  • 167
  • 2
  • 11