0

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?

Brad
  • 159,648
  • 54
  • 349
  • 530
Timmy863
  • 7
  • 6
  • 2
    Possible duplicate of [How to remove .html from URL?](https://stackoverflow.com/questions/5730092/how-to-remove-html-from-url) – Joyal Mathew Nov 18 '18 at 23:42
  • This is related to which server you're using, you'll have to mention or add a tag to say which server it is to your question. – Rainbow Nov 19 '18 at 00:02

2 Answers2

1

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:

LogLevel alert rewrite:trace3

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.

lod
  • 1,098
  • 10
  • 13
0

Use this meta and then upload your files into the web root without the .html extension

<meta http-equiv="content-type" content="text/html; UTF-8">
Denise
  • 19
  • 5