Removing .html and index.html from URL
- by James Turner
I'm having some problems trying to
Remove the .html extension from URLs
Removing 'index.html' from an URL
1) To remove the extension I have tried using this in my htaccess file.
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html
However when I click links in my HTML such as <a href="abcde.html"></a> it doesn't remove the .html from the URL and I am left with www.website.com/abcde.html
2) I tried using this to remove the index.html
RewriteCond %{THE_REQUEST} \/index\.(php|html)\ HTTP [NC]
RewriteRule (.*)index\.(php|html)$ /$1 [R=301,L]
But when I load an index.html file on my server, my URL looks something like this
www.website.com/folder//
I am left with an extra / at the end.
Can anyone help me out?