0

Is there a way to "unset" an arbitrary Apache directive such as by repeating it verbatim but with Unset or something in front of it?

For example let's say at the server config level I have:

ScriptAliasMatch "^/cgi-bin(.*)" "/usr/local/apache/cgi-bin$1"

At for one of the VirtualHosts I'd like to be able to put something like the following:

Unset ScriptAliasMatch "^/cgi-bin(.*)" "/usr/local/apache/cgi-bin$1"

If there's a specific approach for this directive that I'm missing, I'm interested in that as well (the best I can think of is to block access to that pattern via mod_rewrite), but I'm especially interested in whether there is a way to unset as that might be handy to know for the future.

sa289
  • 1,318
  • 2
  • 18
  • 44

1 Answers1

1

I think the easiest solution is to move the directive from the server level to the virtualhost level, if the server-wide setting proves unacceptable for a vhost.

Use a default Include in every vhost and omit it in the vhosts where you deviate from the norm.

The new <If> (httpd 2.4) might be an option too.

fuero
  • 9,591
  • 1
  • 35
  • 40
  • `` can appear in the server config, virtual host, directory, .htaccess contexts and the poster is using `ScriptAliasMatch` in the server config context so I think `` would work. – Mark Wagner Jul 20 '15 at 18:56
  • Bah, looked at the wrong line in the quick reference. Thanks for catching this. – fuero Jul 20 '15 at 19:21