structure in root is:
ROOT\_public
ROOT\_blog
ROOT\_about
when something comes to domain.com/blog it will read root_blog (first) when something comes to domain.com/maps it will read root_maps (second) when comes everything else, it will read root_public folder .. (third)
third is doesnt work!
why?
RewriteEngine on
# rewrite to trailing shash in domain/about and domain/maps
RewriteRule ^(about|blog|docs)$ /$1/ [R]
# rewrite domain.com/about/something to /_about/something
RewriteRule ^(about|blog|docs)/(.*)$ /_$1/$2/
# rewrite开发者_开发技巧 anything that doesn't start about/ or maps/ to _public
RewriteCond %{REQUEST_URI} !^/(about|maps|docs)/
RewriteRule ^(.*)$ _public/$1
i havent idea, why its doesnt work. please help. thank you!
/somethingelse will be directed to _public/somethingelse _public/somethingelse will in turn be directed to _public/_public/somethingelse _public/_public/somethingelse ...etc.
You need to stop rewriting if already rewritten.
RewriteRule ^_ - [L]
RewriteCond %{REQUEST_URI} !^/(about|maps|docs)/
RewriteRule ^(.*)$ _public/$1
The added line will match anything starting with "_" and stop applying any rules below it.
精彩评论