Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Apache重写模块跳过路径_Php_Apache_.htaccess_Mod Rewrite - Fatal编程技术网

Php Apache重写模块跳过路径

Php Apache重写模块跳过路径,php,apache,.htaccess,mod-rewrite,Php,Apache,.htaccess,Mod Rewrite,如何告诉apache重写模块跳过重写某个路径,目前我在.htaccess中有以下代码 <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !^(ampache)$ RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] 重新启动发动机 重写cond%{REQUEST_FILENAME}^(安帕奇)$ 重写cond%

如何告诉apache重写模块跳过重写某个路径,目前我在.htaccess中有以下代码

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !^(ampache)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

重新启动发动机
重写cond%{REQUEST_FILENAME}^(安帕奇)$
重写cond%{REQUEST_FILENAME}-F
重写规则^index.php[L]
具体来说,我想让以
ampache
开头的路径通过而不被重写。
上面的代码不能满足我的需要。

使用
请求URI
而不是
请求文件名
,因为
请求文件名
匹配完整的文件系统路径

您可以使用此已更正的规则:

RewriteEngine On

RewriteCond %{REQUEST_URI} !^/ampache(/.*)?$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [L]
甚至这种否定模式也会起作用:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule !^/?ampache(/.*)?$ index.php [L,NC]

我想要的是,当path=
ampache
yes时,不要重定向到index.php,这就是这个规则所做的。如果URI以
/ampache
开头,则上述规则将不会路由到
index.php