Reputation: 1
I have an .htaccess
file with the following code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} (/|\.html|/[^.]*)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([A-Za-z0-9-_]+)/?$ $1.html [NC]
</IfModule>
But it is not working. I want to change the URL, e.g., www.example.com/about.html
to www.example.com/about
and so on.
Upvotes: 0
Views: 150
Reputation: 21062
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html
Keep this in your .htaccess
snippets file if you don't understand it for the next time. Replace .html
with the file extension you need to remove.
Upvotes: 3