排除来自重写规则的文件夹/目录重写、文件夹、规则、目录

2023-09-02 11:25:25 作者:一撇一捺为你画

我有一个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