apache 如何为一个子类别禁用 RewriteRule?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1521969/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 18:13:39  来源:igfitidea点击:

How can I disable RewriteRule for one subcategory?

apache.htaccessmod-rewrite

提问by Tomasz Smykowski

I have a .htaccess in my root of website that looks like this:

我的网站根目录中有一个 .htaccess,如下所示:

RewriteEngine On

RewriteCond %{HTTP_HOST} !^www\.mydomain\.pl [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?([a-z0-9_-]+)\.mydomain\.pl [NC]
RewriteRule ^/?$ /index.php?run=places/%1 [L,QSA]

RewriteCond %{REQUEST_URI} !^/index.php$
RewriteCond %{REQUEST_URI} !^/images/
RewriteCond %{REQUEST_URI} !^/upload/
RewriteCond %{REQUEST_URI} !^/javascript/
RewriteRule ^(.*)$ /index.php?runit= [L,QSA]

But when I type:

但是当我输入:

mydomain.pl/guests

mydomain.pl/guests

I would like to go normally to actual folder guests. I understand that I need to somehow disable this rule for guests subfolder, but how do I do this?

我想正常去实际文件夹客人。我知道我需要以某种方式为来宾子文件夹禁用此规则,但我该怎么做?

EDIT:

编辑:

I've included whole .htaccess file

我已经包含了整个 .htaccess 文件

回答by Tomasz Smykowski

I've put a htaccess in subfolder and added RewriteEngine Off and it works.

我在子文件夹中放置了一个 htaccess 并添加了 RewriteEngine Off 并且它可以工作。

回答by Vinko Vrsalovic

Add one of these

添加其中之一

RewriteEngine On

#If the request starts with guests, then pass it through
RewriteCond %{REQUEST_URI} ^guests
RewriteRule ^ - [L,QSA]

#Or, if the request contains an existing filename or directory, pass it through
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L,QSA]