.htaccess - htaccess redirect rules - How to redirect up one level? -
.htaccess - htaccess redirect rules - How to redirect up one level? -
http://mysite.com/level-1/level-2/level-3/
i want redirect
http://mysite.com/level-1/level-2/ "level-1" , "level-2" can user enters... (not these exact words)
could direct me tutorial or give me few pointers?
thanks lot!!
based on comment (from level-3 level-2 folder 301 permanent redirect):
rewriteengine on rewritebase / rewriterule ^([^/]+/[^/]+/)[^/]+/$ http://www.example.com/$1 [qsa,r=301,l] this rule redirect example.com/hello/pink/kitten/ example.com/hello/pink/
if url construction different, no redirect occur:
missing trailing slash (e.g.example.com/hello/pink/kitten) 4-level deep url (e.g. example.com/hello/pink/kitten/family/) this rule needs placed in .htaccess in website root folder. if placed elsewhere (e.g. apache config file, within <virtualhost>, example) rule needs little tweaking.
.htaccess mod-rewrite url-rewriting
Comments
Post a Comment