I have a root folder with too subfolder paths
1) /app/webroot/
2) /oldapps/
Lets say for example I have an application called contacts in "/oldapps/contacts" all other requests should be routed to /app/webroot/
I'm trying to use this set of rules in an .htaccess file.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^contacts$ oldapps/contacts/ [L]
RewriteRule ^contacts\/(.*) oldapps/contacts/$1 [L]
RewriteRule ^$ app/webroot/ [L]
RewriteCond %{SCRIPT_FILENAME} !oldapps\/.*
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
This works great until you throw a weird URL at the server that contains the text "oldapps" but is down the /contacts/ path. examples:
http://localhost/contacts/oldapps/
Why didn't the developers of mod_rewrite give you the option to use SCRIPT_NAME instead of SCRIPT_FILENAME ?
I'm developing on Windows deploying on Linux? SCRIPT_FILENAME does not seem very portable. If I could use SCRIPT_NAME I could write the RewriteCond like so:
RewriteCond %{SCRIPT_NAME} !^\/oldapps\/.*
Without this I can't use the ^ character....
Any ideas on how I can write this better? I'd like to keep the code in the .htaccess file.
Thanks,
KellyGreer1