Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have an apache configuration with three virtualhost entries. Each entry is bound to a different port so that we can provide a different SSL certificate based on the port. Our load balancer is transparently redirecting requests to certain domain names to specific ports on the web sever.

The problem that I have is that I have a very long list of fairly complicated RewriteConds and RewriteRules that have to be the same for all three hosts. The only difference between the three entries should be the ServerName, SSLCertificateFile, and SSLCertificateKeyFile entries.

Currently I have the RewriteRules replicated in each VirtualHost entry, but that makes it difficult to update the rules and make sure they are the same across the various entries.

So my question is, is there a way that I can put the RewriteRules in a single location but that will cause them to be applied to all three VirtualHost entries?

As a side note, I'm also using the same rules in a separate non-SSL configuration file.

share|improve this question
add comment

1 Answer

I believe you could put the shared rules into a file and use the Include directive to included them each place they are needed.

here are the docs for the Include directive

share|improve this answer
    
I should have done more searching of the docs. I thought there was an include but my initial search only came up with pages about server-side includes. Thanks. –  Chris Thompson May 16 '12 at 18:45
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.