首页 > 我的文章 > PHP开发 > thinkphp > 如何在.htaccess的URL重写规则中加入排除某个目录的规则

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

浏览:995 编辑:绿萝 来源:绿萝
如何在.htaccess的URL重写规则中加入排除某个目录的规则

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处理。