いくつかの変更を加える必要があります。
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
#Code to add forward slash
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(?:\.\w+|/)$
RewriteRule (.*) $1/ [R,L]
#To check whether a .html appended string is a file existing on the system
RewriteCond %{DOCUMENT_ROOT}/$1.html -f
RewriteRule (.*)/ $1.html [L]
#### NOT REQUIRED
#RewriteCond %{SCRIPT_FILENAME}/ -d
#RewriteCond %{SCRIPT_FILENAME}.html !-f
#RewriteRule [^/]$ %{REQUEST_URI}/ [R,L]
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^(.+)\.html$ /$1 [R,L]
また、これらのルールは期待どおりに機能しません。
RewriteCond %{SCRIPT_FILENAME}.html -f
RewriteRule [^/]+/$ %{REQUEST_URI}.html [QSA,L]
cos、%{REQUEST_URI}
常に/
最後にあります。のような URIdomain.com/about
が要求された場合、
次のように書き換えられます。
domain.com/about/
そして最後に
domain.com/about/.html