从WordPress htaccess重写规则中排除顶级目录

时间:2016-07-24 12:14:32

标签: wordpress apache .htaccess

我们最近将我们的网站更改为WordPress,目录/ wp /中的WordPress文件 我仍然希望从其他根级目录服务其他页面,例如,链接 http://www.2minuteexplainer.com/clients/xxx/some_subdir/

但是任何到达此目录的尝试都会返回Wordpress 404错误。如果我评论出来的话 在htaccess的WordPress的东西,上面的链接按预期工作,但是,当然,旧网站的其余部分也显示出来。

我似乎无法找到重写规则的正确组合。

这是htaccess文件。

Header add Access-Control-Allow-Origin "*"
Options +FollowSymLinks

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?2minuteexplainer.com$

# RewriteRule ^clients/.*$ /clients$ - [PT] 
# one of a number of workarounds I've tried in order to use this directory 

# canonical WordPress stuff follows:

RewriteRule ^(/)?$ wp [L]

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wp/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wp/index.php [L]
</IfModule>

# END WordPress

似乎我必须犯一个简单的错误。但它是什么?

THX。

1 个答案:

答案 0 :(得分:0)

解决方案是将mod_rewrite内容(以#BEGIN WordPress开头)移动到控制WordPress安装的.htaccess文件中。在我的情况下它是/ wp /。简单,一旦你知道如何: - )

相关问题