Help creating URI rewrite using RewriteRule
I am using this for my rewrite
RewriteRule ^site/(.*) index.php?rewrite=$1 [L]
RewriteRule (.*)\.xml(.*) $1.php$2 [nocase]
I am started to phase this site into a psuedo mvc system and really need to the above to read
1. If the directory is NOT ^site/public/* OR ^site/assets/* or (etc) then re-write the url as index.php?rewrite=$1 (I'm basically trying to replicate the fi开发者_开发知识库rst rule above for all cases except a couple).
2. ALSO, go ahead and rewrite all .xml pages to be changed to .php
You can condition the first rule to prevent it from being applied in those particular cases:
# Only apply the rule when the captured section does not start
# with public/ or assets/
RewriteCond $1 !^(public|assets)/
RewriteRule ^site/(.*) index.php?rewrite=$1 [L]
It seems that the second rule already does what you're expecting, so if that's not the case you'll need to elaborate on what the problem is there.
精彩评论