apache - htaccess get folder one level below -
i have folders in root of server:
css/ js/ gfx/ new_www/ ...
and more. assuming want in folder new_www copy of current page, force use things root folder (for example gfx folder). i've tried following .htaccess not working:
rewriteengine on rewritebase / rewriterule /new_www/_js/(.*) /_js/$1 [l] rewriterule /new_www/gfx/(.*) /gfx/$1 [l]
what doing wrong? .htaccess placed in root of folder.
please understand rewriterule doesn't match leading slash in uri when used in .htaccess. code should replaced this:
options +followsymlinks -multiviews # turn mod_rewrite on rewriteengine on rewritebase / rewriterule ^new_www/(_js/.*)$ /$1 [l,nc] rewriterule ^new_www/(gfx/.*)$ /$1 [l,nc]
or better have 1 rule this:
rewriterule ^new_www/(.+)$ /$1 [l,nc]
Comments
Post a Comment