Url rewriting for Zeus - regex help
I've been landed with the unenviable task of putting a site live today only to find out its not running on Apache but instead is using Zeus. Now this breaks my开发者_StackOverflow中文版 mod_rewrite script rather messily.
Its a simple script which I've rewrote into Zeus format:
RewriteEngine on
RewriteRule !404.php$ blog/404.php [L]
becomes
match URL into $ with ^/blog/(.*)
if matched set URL=/blog/404.php
However, the downside is that whereas I turned mod_rewrite off in some of the child directories (eg css, images etc) I cant do this in Zeus.
Been playing around with regex to try and get the above regex to exclude any matches for /blog/css/ or /blog/images but no luck.
Hoping someone out there can help me out!
edit. currently working on this regex...
^(?=/blog/)((?!css/|images/|js/).)*$
So this should match any link with /blog/ in but exclude those with /blog/css, /blog/js and /blog/images. But it doesnt ><
I have no idea of Zeus rewrites (I've never even heard of the product) but as long as there is no answer from an experienced user: According to this blog post, it is possible to nest rules in Zeus.
Something along these lines might work to turn off rewriting in /blog/css:
match URL into $ with ^/blog/css/(.*)
if not matched
... your 404 rewrite rule here
endif;
this is educated guesswork, but if I understand the syntax correctly it shoudln't be too far off.
Ok after trying lots of regex fanciness I went with KISS and came up with this. Hope it helps someone
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
精彩评论