My root dir contains some .html files.
I want to remove an extension of .html in address bar and add a slash in the end like this: http://domain.com/page/
I’ve tried lots of solutions, one of them:
RewriteEngine on
RewriteBase /
# redirect from ww to non-www
RewriteCond %{HTTP_HOST} ^www.nightmaar.com$ [NC]
RewriteRule ^(.*)$ http://nightmaar.com/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{THE_REQUEST} ^GET\ /[^?\s]+\.html
RewriteRule (.*)\.html$ /$1/ [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*)/$ $1.html [L]
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule .*[^/]$ $0/ [L,R=301]
But the browser gives an error (too many redirects). When i’m trying to access my static html pages, there no redirects from page.html to /page/ at all.
Help me please to solve this problem :S
You almost did it!
Here’s what should work: