我想更好地理解mod_rewrite,并有一个特殊的问题,我想我需要首先让我的头部轮。mod_rewrite问题:否定
我使用以下
RewriteRule ^(?!index.php)(.*)$ index.php?path=$1 [NC,L]
的等效重写会,在这种情况下,要重写http://www.somesite.tld/a/b/c
到index.php?path=a/b/c
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?path=$1 [NC,L]
- 这不无
RewriteCond
工作 - 路径= index.php将会是没有特别忽略文件或者说'不是index.php'的结果。 这是为什么? - 此外,我有时会看到使用的
?!
和?:
语法是什么?我不明白在没有任何前缀的情况下使用?
。 - 为什么在上面的第一个RewriteRule中,第二对括号会返回1美元的匹配?
干杯
很高兴我问了这个问题,我不知道前瞻断言,但它们看起来非常有用。 – dianovich 2011-02-28 14:50:44