Python的SimpleHTTPServer是否可以使用我的.htaccess文件?我的目录包含:
.htaccess
index.html
view1.html
在.htaccess中,我有以下代码:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html
(删除页面上的.html,以便mysite.com/view1
进入view1.html
)
此代码在我的网站上有效,并且我的链接设置如下:
<a class="top-nav-link" href="views/about">
About
</a>
这在我的生产服务器上工作正常,但是在本地,我正在使用SimpleHTTPServer
进行开发,这些链接都使我遇到404错误,但可以肯定的是,在URL末尾添加.html
会加载它本地。
有没有一种方法可以使其加载而不必手动添加.html
(通过阅读.htaccess)?