使用 .htaccess 移除 html 頁面副檔名

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}/$1.html -f
RewriteRule (.+)/$ $1.html [L]

RewriteCond %{THE_REQUEST} \.html\s
RewriteRule (.+)\.html$ /$1/ [R=301,L]

參考連結

https://webmasters.stackexchange.com/questions/133746/how-to-remove-all-html-extensions-from-all-pages-of-site-running-under-apache
https://httpd.apache.org/docs/2.4/mod/mod_rewrite.html