【发布时间】:2019-11-28 20:31:02
【问题描述】:
我有一个非常标准的重写规则,可以通过索引将所有内容推送给我的 CMS 来处理。
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}/index.html !-f
RewriteCond %{REQUEST_FILENAME}/index.php !-f
RewriteRule . index.php [L]
</IfModule>
我想将我的主页和几个基础博客作为静态 html 来提供,以提高加载速度。当请求 root 时,如何告诉 Apache2 服务 /path/to/some.html?
我试过了
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} "^/$"
RewriteRule ^/$ /path/to/some.html
RewriteCond %{REQUEST_URI} "^/some/important/path$"
RewriteRule ^/$ /path/to/some/other.html
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}/index.html !-f
RewriteCond %{REQUEST_FILENAME}/index.php !-f
RewriteRule . index.php [L]
</IfModule>
但这一切仍然通过索引提供服务并由 CMS 处理。我做错了什么?
【问题讨论】: