I am trying to remove the .html extension on my website URL but nothing seems to work.
<Website>.
I have made a .htaccess file and put in the following:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^.]+)$ $1.html [NC,L]
AND
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^.]+)$ $1.html [NC,L]
but I find that nothing seems to work. Any ideas?
2
Answers
Your rewrite implementation is fine.
You most likely don’t have htaccess
AllowOverride
directives enabled, or possibly mod_rewrite is not switched on.If you have access to the server configuration and logs it is better to put the rewrite directives in the server configuration file. It is faster, cleaner and avoids possible
AllowOverride
issues. The logs should show exactly what is happening, you can temporarily enable verbose mod_rewrite logging with:If you don’t have access to the server configuration and logs then you will need to contact your provider. Without access to those it is impossible to solve the problem.
Use this meta and then upload your files into the web root without the .html extension