I have resources for two websites located here…
localhost/index.php /* rewrite handler */
localhost/images/
localhost/scripts/
Then I have the two sites…
localhost/site1/
localhost/site2/
I want to rewrite…
localhost/site1/images/
localhost/site2/images/
localhost/site1/scripts/
localhost/site2/scripts/
…to…
localhost/images/site1/
localhost/images/site2/
localhost/scripts/site1/
localhost/scripts/site2/
Is there a way to make “site1” and “site2” a dynamic variable (so that I don’t have to manually add an exception or rule if I add more sites in the future) that will rewrite in this manner?
This rule REWRITES the directory, I want to be able to access the files AS WELL, not just the index…
RewriteRule .*\/scripts\/$ scripts\/$1 [L]
For once the Apache documentation was useful!
http://httpd.apache.org/docs/2.3/rewrite/flags.html#flag_qsa