我已经完成了一项不值得羡慕的任务:今天让一个网站上线,结果却发现它不是运行在Apache上,而是使用了Zeus。现在,这相当混乱地破坏了我的mod_rewrite脚本。
这是一个简单的脚本,我已经将其重写为Zeus格式:
RewriteEngine on
RewriteRule !404.php$ blog/404.php [L]变成了
match URL into $ with ^/blog/(.*)
if matched set URL=/blog/404.php然而,缺点是我在一些子目录(例如css、图像等)中关闭了mod_rewrite,但我不能在Zeus中这样做。
我一直在尝试使用正则表达式,尝试让上面的正则表达式排除/blog/css/或/blog/images的任何匹配,但没有成功。
希望外面有人能帮我!
编辑。目前正在处理这个正则表达式...
^(?=/blog/)((?!css/|images/|js/).)*$ 所以这应该匹配带有/blog/ in的任何链接,但不包括那些带有/blog/css、/blog/js和/blog/images的链接。但它不是><
发布于 2010-10-08 18:16:25
好的,在尝试了很多正则表达式的幻想之后,我选择了KISS,并想出了这个。希望这能帮助到某个人
match URL into $ with ^/blog/(.*)$
if matched
match URL into $ with ^/blog/css/(.*)$
if not matched
match URL into $ with ^/blog/images/(.*)$
if not matched
match URL into $ with ^/blog/js/(.*)$
if not matched
set URL=/blog/404.php
endif
endif
endif
endif发布于 2010-10-04 21:25:37
我不知道Zeus重写(我甚至从来没有听说过这个产品),但只要有经验的用户没有回答:根据this blog post的说法,在Zeus中嵌套规则是可能的。
下面的内容可能可以关闭/blog/css中的重写:
match URL into $ with ^/blog/css/(.*)
if not matched
... your 404 rewrite rule here
endif;这是经过深思熟虑的猜测,但如果我正确理解语法,它应该不会太远。
https://stackoverflow.com/questions/3855236
复制相似问题