【发布时间】:2011-01-20 12:07:15
【问题描述】:
在 WordPress 中,我有一个名为 Experiments 的页面,其中包含 experiments。该页面应该可以通过http://site.com/experiments 访问。
问题是,我还想在我的服务器上有一个具有该名称的文件夹,以便http://site.com/experiments/thing/ 加载该文件夹的index.html 文件(如果有的话)。
我以为我找到了完美的重写结构(来自this blog post):
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
# RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}/index.htm !-f
RewriteCond %{REQUEST_FILENAME}/index.php !-f
RewriteRule . /index.php [L]
</IfModule>
# BEGIN WordPress
# END WordPress
看起来它使用 WordPress 重写目录,除非该目录有 index.html 或 index.php 文件,在这种情况下它会忽略 WordPress 加载它。它非常适用于子目录,但http://site.com/experiments/ 试图永远来回重定向到http://site.com/experiments。
有人知道我做错了什么吗?
【问题讨论】:
标签: php apache wordpress mod-rewrite url-rewriting