如何在.htaccess的URL重写规则中加入排除某个目录的规则

发布时间:2017-01-11 17:21:35编辑:丝画阁阅读(987)

WordPress在Apache中部署的时候使用.htaccess指定重写规则。但是,有时候需要绕过wordpress,直接在站点中加入自己写的页面。下面是一种可行的做法.


RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ – [L]
RewriteCond %{REQUEST_URI} !^/(custom|custom/.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

上面的设置生效后,访问URL custom/ 下的页面将不会被wordpress处理。

关键字