我有一个网站,上面有一些 html 文件。其中之一是contact.html。这是我的 .htaccess,我在可以使用 site.com/contact 而非 site.com/contact/ 寻址页面时遇到问题。(注意结束斜线。)解决方法是什么?
RewriteEngine On
# If the requested URI does not contain a period in the final path-part
RewriteCond %{REQUEST_URI} !(\.[^./]+)$
# and if it does not exist as a directory
RewriteCond %{REQUEST_fileNAME} !-d
# and if it does not exist as a file
RewriteCond %{REQUEST_fileNAME} !-f
# then add .html to get the actual filename
rewriterule (.*) /$1.html [L]