I have a domain with multiple domains parked on it.
What I need to do is to redirect every traffic from subdirectories to root path. f开发者_开发百科or example my domain isexample.com
when the visitor lands on a subdirectory I want him to be redirected to the root. like this:
http://example.com/foo ==> http://example.com
and also consider the part about parked domains.
http://bar.com/foo == > http://bar.com (parked on example.com)
this rewrite rule rewrites all requests from sub-directory to one level-up(root).
RewriteEngine on
RewriteRule ^([^/]+)\/(.*)$ $2 [L]
I found the answer and it's done like this:
RewriteRule ^([^/]+)(.*)$ / [R]
Special thanks to Death
.
精彩评论