Is there a way to have a RewriteRule fire on any domain that is requested on a box? For example, I have 5 VirtualHosts that would have the exact same RewriteRule applied to them and currently each VirtualHost directive has the rule, but can I put this somewhere 'global' so that upkeep is easier?
A:
You can, but it is somewhat of a hack. Create your RewriteRule in a .htaccess somewhere like:
/www/redirects/global/.htaccess
Now just set the DocumentRoot for your virtualhosts to /www/redirects/global/ and every request will be forced through your RewriteRule's.
Jack M.
2008-10-15 15:08:50
A:
I haven't tested it, but the mod_rewrite docs say that RewriteRule can be used in the server config context.
You may also want to look up how RewriteMaps work. Since these are a file, they could be considered to be a "global" source, but there are limitations on them since they are primarily static.
R. Bemrose
2008-10-15 15:19:18