我怎么忽略了mod_rewrite的目录? [英] How do I ignore a directory in mod_rewrite?
问题描述
我想有modrewrite规则跳过目录 VIP
。我已经尝试了一些事情,你可以看到下面,但无济于事。
I'm trying to have the modrewrite rules skip the directory vip
. I've tried a number of things as you can see below, but to no avail.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#RewriteRule ^vip$ - [PT]
RewriteRule ^vip/.$ - [PT]
#RewriteCond %{REQUEST_URI} !/vip
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
我要如何modrewrite完全忽略 / VIP /
目录,以便所有的请求直接传递到文件夹?
How do I get modrewrite to entirely ignore the /vip/
directory so that all requests pass directly to the folder?
由于清晰度的要点:
- 它托管在Dreamhost的
- 的文件夹是一个字preSS目录中的
- 的/ VIP /文件夹中包含一个WebDAV的.htaccess等(虽然我不认为这是重要的
推荐答案
尝试之前,任何其他规则把这个。
Try putting this before any other rules.
RewriteRule ^vip - [L,NC]
这将匹配任何URI开始 VIP
。
- 的
-
表示无可奈何。 - 的
→
表示,这应该是最后一条规则;不顾一切以下。 - 的
NC
意味着没有情况(所以贵宾也匹配)。
- The
-
means do nothing. - The
L
means this should be last rule; ignore everything following. - The
NC
means no-case (so "VIP" is also matched).
请注意,它匹配任何的开始的 VIP
。这位前pression ^ VIP $
将匹配 VIP
而不是 VIP /
或 VIP / index.html的
。在 $
可能是您的垮台。如果你真的想这样做的权利,你可能要与去^ VIP(/ | $)
这样你就不会匹配 VIP-页html的
Note that it matches anything beginning vip
. The expression ^vip$
would match vip
but not vip/
or vip/index.html
. The $
may have been your downfall. If you really want to do it right, you might want to go with ^vip(/|$)
so you don't match vip-page.html
这篇关于我怎么忽略了mod_rewrite的目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!