I've got a lengthy and intricate listing of <VirtualHost> directives, and I must duplicate them into separate <VirtualHost> groups for ports 80 and 443 because I am using SSL. Whenever I update my mod_rewrite rules I must remember to get it done both in places otherwise I'll break my application... this duplication is requesting trouble. It is possible to method to mix or alias these -- the only real distinction between the 2 would be that the port 443 version consists of the SSLEngine, SSLCertificateFile and so on.
My <Virtualhost> consists of many mod_rewrite rules, LocationMatch rules, CGI directives, etc.
Also, I can not use .htaccess files.
Can't you utilize an include directive to incorporate the most popular rules. here
<VirtualHost _default_:80> ... include conf/common_rule.conf </VirtualHost> <VirtualHost _default_:*> ... include conf/common_rule.conf </VirtualHost> <VirtualHost _default_:443> ... #SSL rules include conf/common_rule.conf </VirtualHost>
You can place the common configuration right into a separate file and can include it both in VirtualHost segments:
Include conf/common.conf (place your ssl specific cofiguration stuff here ...)
You might specify the most popular directives inside a container rather than inside the itself. That is what I actually do, mostly because I favor mod_rewrite rules in the directory level rather than in the server level, however it should work as well for you personally too.