RewriteMap & Virtual hosts Apache 2.2

Discussion in 'Apache' started by nybbles2byte, Feb 26, 2012.

  1. #1
    I suspect it's just that I haven't had to do anything with Apache for so long that I am missing something obvious but here it goes...

    I have a RewriteMap directive that I put on the server level and then a RewiteRule that is in a .htaccess file. I couldn't get them to work with each other so I tried putting the RewiteRule at the server level (in httpd.conf.local). That didn't work. So then I put the RewriteMap directive in a VirtualHost section instead of the server level and finally the RewiteRule (in the .htaccess file) picked up the RewriteMap directive and the rule worked.

    Since my Map is all redirects between domains this means for this to work I would have to put the RewriteMap directive into every VirtualHost section. This seems like a real waste. Is there a way to get the RewriteMap to work with the RewiteRule without multiplying out the RewriteMap statement into every VirtualHost section? Like I said, I started it at the server level but it just wasn't getting picked up by the rule and putting the rule with it at the server level didn't work either.

    I should mention that the RewriteMap directive isn't allowed in the .htaccess file otherwise the solution would be obvious.

    Thanks !
     
    nybbles2byte, Feb 26, 2012 IP