I've got developers editing pages for several sites on a WAMP stack and then uploading to the public servers running LAMP stacks. We're pretty happy with it, but we have this minor annoyance: we can't quite use the same .htaccess files in the development and production environments. On the public sites, the source folder maps to
http://bar.com, and so on. On the developer workstation, the source folders map to
http://localhost/bar, and so on. That means that I need
RewriteBase / for the public servers, while each site on the developer workstation uses
RewriteBase /bar/, or whatever.
Is there any way to specify the RewriteBase relative to the
.htaccess file? Any other ideas for how to make my rewrite rules more portable?
If you're curious, I'm using rewrite rules to redirect to CakePHP routing code, so the rule looks like this:
RewriteRule ^(.*)$ cake_main.php?url=$1 [QSA,L]
If I don't use a RewriteBase of
/foo/ on the developer workstation, then it will rewrite to
/cake_main.php instead of