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,而不是实际的目录。我把它改为“路径段”。