0

how do i move a web app that uses rewrite rules and lives in the root of the web server to a sub-directory?

i have an app running on my apache web server that uses the following rewrite rules in an .htaccess file:

RewriteCond $1 !^(tool|web|files)
RewriteCond %{REQUEST_URI} !((.*)\.(.*))$
RewriteRule ^(.*)$ dispatcher.php?route=/$1 [NC,L]
RewriteRule ^(img|css|js)/(.*) web/$1/$2 [L,QSA]

the app currently lives in the root of the web server. i want to move it to a sub-directory but when i do the app no longer works. i tried adding RewriteBase /newdir but that only makes the main pages work and not the css/img/js directories.

ideally, i'd like to NOT change the existing rules but instead add an additional rule.

1 Answer 1

0

First, I think the RewriteBase /newdir is right, that would apply your rules in the new directory, the rule works fine.

Second, you may need to remove the caret (^) character from the last rule, something like this should work.

RewriteRule ^(.)/(img|css|js)/(.) web/$2/$3 [L,QSA]

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .