排除来自重写规则的文件夹/目录 [英] Exclude a folder/directory from RewriteRule

查看:301
本文介绍了排除来自重写规则的文件夹/目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个pretty的标准的Word preSS的.htaccess使用下列URL重写

I have a pretty standard WordPress .htaccess with the following URL rewrites

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

字preSS安装在我的域根。我在子文件夹中,例如一些其他脚本/ opencart这些子文件夹包含自己的.htaccess文件。

WordPress is installed in my domain root. I have some other scripts in subfolders, e.g. /opencart These subfolders contain their own .htaccess files.

不幸的是,似乎这个词preSS劫持重写一些这些脚本的时候。

Unfortunately, it seems that WordPress hijacks the rewrites for some of these scripts sometimes.

怎么能要求的mod_rewrite忽略了重写字preSS规则时,与特定的子文件夹,例如遇到opencart和使用这些子文件夹中的的.htaccess中定义的规则呢?

How can I ask mod_rewrite to ignore WordPress rules for rewrites when encountered with specific subfolders e.g. opencart and to use the rules defined in the .htaccess within these subfolders instead?

推荐答案

您可以尝试更换整个WP规则集这一个:

You may try replacing the complete WP rule-set with this one:

# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]

# Include in the next line all folders to exclude
RewriteCond %{REQUEST_URI}  !(folder1|folder2|folder3) [NC]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress 

这篇关于排除来自重写规则的文件夹/目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆