I am trying to figure how to make a .htaccess RewriteRule so a visitor views e开发者_JS百科xample.com/folder
but is served
example.com/f1/f2/f3/folder/index.php
where f1/... is just an arbitrary line of folders.
I have kicked mod_rewrite a little, and got some really weird results, none I was going for though.
I'm not quite sure what you're trying to achieve. This, however, might solve your problem. Basically it translates any query for /folder, /folder/ or /folder/... to /f1/f2/f3/folder/...:
RewriteRule ^folder(/.*)?$ f1/f2/f3/folder$1
EDIT
If you don't care about anything after site.com/folder, this should suffice:
RewriteRule ^folder$ f1/f2/f3/folder/index.php
EDIT #2
Rewriting the root (according to comment by OP):
RewriteRule ^(.*)$ folder1/folder2/$1 [QSA]
There may be other (better?) ways to translate the root, though.
Docs are available on the QSA directive.
加载中,请稍侯......
精彩评论