今天我试图从我的网站中删除html文件扩展名,例如:example.com/page.html
至example.com/page
我看了一些教程,但似乎没有工作...我在根目录中创建了.htaccess
文件
复制的代码(也尝试了不同的代码):
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html [NC,L]
它不工作时,我打开我的网站作为文件,与Live Server(VS代码扩展)或实际的网站(托管在Replit)
有什么想法吗,为什么它不工作?任何帮助感激...
请参阅whole repository
1条答案
按热度按时间x0fgdtte1#
余淼应该这样做: