Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/10.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
Apache 多重重写秒正则表达式_Apache_Mod Rewrite_Url Rewriting - Fatal编程技术网

Apache 多重重写秒正则表达式

Apache 多重重写秒正则表达式,apache,mod-rewrite,url-rewriting,Apache,Mod Rewrite,Url Rewriting,所以我有以下网址 foo/ foo/abc/ foo/def/ foo/ghi/ foo/([a-zA-Z0-9\-]+)/ 我只想重写最后一个。前四个(路径段)是固定的 if first path segment is "foo" and we have a second path segment and second path segment is not "abc" and second path segment is not "def" and second path segment

所以我有以下网址

foo/
foo/abc/
foo/def/
foo/ghi/
foo/([a-zA-Z0-9\-]+)/
我只想重写最后一个。前四个(路径段)是固定的

if first path segment is "foo"
and we have a second path segment
and second path segment is not "abc"
and second path segment is not "def"
and second path segment is not "ghi"
then ^foo/([a-zA-Z0-9\-]+)/$ index.php?id=20&alias=$1 [L, QSA]

你可以使用消极的前瞻

RewriteEngine On

RewriteRule ^foo/((?!abc|def|ghi)[a-z0-9-]+)/$ index.php?id=20&alias=$1 [L,QSA]

你可以使用消极的前瞻

RewriteEngine On

RewriteRule ^foo/((?!abc|def|ghi)[a-z0-9-]+)/$ index.php?id=20&alias=$1 [L,QSA]

“Fixed”并不意味着,它实际上是作为目录存在的(而其他任何东西都不存在)?因为你最好使用
-d
标志(即否定)No,而不是实际的目录。我把它改成了“路径段”。“固定”并不意味着,它实际上是作为目录存在的(而其他任何东西都不存在)?因为你最好使用
-d
标志(即否定)No,而不是实际的目录。我把它改为“路径段”。