.htaccess - How to get parent folder in htaccess? -


i want insert images, css , js dynamic. have folder themes , there want have multiple themes.

below structure of app. themes folder located in root.

structure

i have added record in .htaccess:

rewriterule ^(css|js|img)/(.*)$ /themes/default/$1/$2 

and path redirected like:

/css/style.css             http://site.com/themes/default/css/style.css /js/somelib.js             http://site.com/themes/default/js/somelib.js /img/background.jpg        http://site.com/themes/default/img/background.jpg 

now want default directory dynamic.

i tried this

rewriterule ^(css|js|img)/(.*)$ ../$1/$2 

and tried

/default/css/style.css rewriterule ^(.*)/(css|js|img)/(.*)$ /themes/$1/$2/$3 

but without result :(

try code:

options +followsymlinks -multiviews # turn mod_rewrite on rewriteengine on rewritebase /  rewritecond %{request_filename} !-f rewriterule ^([^/]+)/((?:css|js|img)/.+)$ /themes/$1/$2 [l,nc] 

Comments