ending rewriting with mod_rewrite

Hi,

I have a problem with mod_rewrite.

I have two (or more) rules, where URL after rewriting with the first one matches the next rule.

[code]
RewriteRule ^data/([a-zA-Z0-9_]+)/([a-zA-Z0-9_.]+)$ modules/$1/data/$2 [L,E=D:1]
RewriteRule ^layout/([a-zA-Z0-9_.,-/]+)$ layout/$1 [L,E=D:1,QSA]
RewriteCond %{ENV:D} ^1$
RewriteRule ^([a-zA-Z_][a-zA-Z_0-9]+)$ app.php?_=$1 [L,E=D:1,QSA]
RewriteCond %{ENV:D} ^1$
RewriteRule ^([a-zA-Z_][a-zA-Z_0-9]+)/([a-zA-Z0-9_.,-/]+)$ app.php?_=$1&path=$2 [L,E=D:1,QSA]
RewriteCond %{ENV:D} ^1$
RewriteRule ^$ app.php [L,E=D:1,QSA]
[/code]

I had to add RewriteConds so the first rewritten rule (to module/...) doesn't get caught in later rules.
Is there a better way to do that ?

Oh, I'm not expert on regular expressions, so they arn't as pretty as they could be :)
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories