I have lots and lots of virtualhosts to support lots and lots of client domains. I want to add a feature to my core app that requires a couple mod_rewrite rules to be applied to ALL those domains. Best approach I have so far is to add the rules to my global httpd.conf, and add these two lines to every single virtualhost:
RewriteEngine On
RewriteOptions Inherit
But it would obviously be preferable to accomplish this without having to edit every virtualhost. Is there any way to make my mod_rewrite rules apply to al开发者_JS百科l virtualhosts without editing them?
Well, this may not apply to you, but if you have a lot of virtualhosts and that all theses virtualhosts share common things you could use mod_rewrite to do the virtualhosting and have only one file:
Search "Mass Virtual Hosting" in this document and you can read this one for more detailled examples (going from the simpliest one to the one with a file mapping domains and document roots).
If you have some very specific configurations on some VirtualHosts you cannot handle them in this system, but if you can group your handled domains by types (with identical configurations for each type) you can use this system.
About the 'simpliest' way, this is maybe not the simpliest as it really need big changes and tests. But it will be really a simplier system after these changes if you are managing clones.
精彩评论