Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got a set of virtual hosts that need separate vhost definitions for *:80 and *:443. After creating these, I've found that I've got 20-40 configuration parameters that both *:80 and *:443 share; Is there a way to specify these once and have them shared, rather than twice (once in each VirtualHost definition?)

share|improve this question

Just create a separate config file fragment containing the shared directives and Include it from both virtual host definitions. (Make sure it's placed someplace where Apache won't try to include it by itself, like it would a .conf file in a conf.d directory.)

share|improve this answer

Rewriting in Virtual Hosts

#By default, mod_rewrite configuration settings from the main
#server context are not inherited by virtual hosts. 
#To make the main server settings apply to virtual hosts, 
#place the following directives in each <VirtualHost> section:
RewriteEngine On
RewriteOptions Inherit
share|improve this answer

Your Answer


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.