RewriteEngine On
RewriteRule ^site/((?!myFolder/).*)$ site/myFolder/$1 [L,NC]
The infinite loop is because you are endlessly matching myFolder no doubt. Need to exclude that from the pattern. Since the match pattern is a Perl Compatible Reguar Expression, You can use a negative, zero width assertion (?!regex)
Add this to server conf or .htaccess
RewriteEngine On
RewriteRule ^site/((?!myFolder/).*)$ site/myFolder/$1 [L,NC]
发布评论
评论(2)
无限循环是因为你毫无疑问地无休止地匹配 myFolder 。需要将其从模式中排除。由于匹配模式是 Perl 兼容的正则表达式,因此您可以使用负的零宽度断言 (?!regex)
将其添加到服务器 conf 或 .htaccess
The infinite loop is because you are endlessly matching myFolder no doubt. Need to exclude that from the pattern. Since the match pattern is a Perl Compatible Reguar Expression, You can use a negative, zero width assertion (?!regex)
Add this to server conf or .htaccess
这样做:
尽管在您的情况下,
仅上述内容并不需要。
将负责循环终止。
Do this:
Although in your case
will not be required just for the above.
will take care of the loop termination.