Per the recommendation in this thread, I am trying to rewrite my .htaccess file to remove the .html suffix from my site's urls. For example, I want "my-website.ca/ecology.html" to be shortened to "my-website.ca/ecology". However, I am getting some errors (see below).
I appended the following code to my .htaccess file. (Note: I already had RewriteEngine On
from previous tinkering.)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\.html$ /$1 [L,R=301]
The results have been... weird. Sometimes it doesn't work, and I'm given a "bad flag delimiter" error. Other times, it works for all but one webpage: ecology.html. When I try to access that, I get a weird page asking me to contact the site's webmaster and the log has a "no matching directoryindex"
I worked out that "ecology.html" had a common name with a folder called "ecology" which I have since renamed to "science". But that didn't fix it.
I'd appreciate any advice.