Super User is a question and answer site for computer enthusiasts and power users. 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 have an apache instance serving different locations, eg

Each of these has access control rules based on IP address/hostname. Some of them use the same configuration though, so I have to repeat the same rules each time:

Order Deny,Allow
Deny from All
Allow from 10.35

Is there a way to make these reusable so that I don't have to change each instance everytime something changes? Ie, can I write this once, then use it for a couple of locations? Using SetEnvIf maybe? It would be nice if I could do something like this pseudo-config:

  Order Deny,Allow
  Deny from All
  Allow from 10.35

<Proxy /jira*>
  AccessRule = myaccessrule

<Location /svn>
  AccessRule = myaccessrule

<Directory /websvn>
  AccessRule = myaccessrule
share|improve this question
up vote 3 down vote accepted

You're after mod_macro.

share|improve this answer
exactly what I'm after. Thanks! – stijn Jan 5 '11 at 11:10

If you're already using mod_perl, remember that mod_perl wraps the config bits of Apache as well as the data serving bits.

share|improve this answer
interesting as well. Unfortunately my perl skill level is like zero :] – stijn Jan 5 '11 at 17:02

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.