I want to put a condition in my apache config that if a request comes from a specific IP then load a particular config file. Is this possible?

E.g.

if (192.168.1.1)
Include conf/mod_security.conf
link|improve this question

0% accept rate
feedback

1 Answer

You can't choose to include a configuration file within your apache configuration based on the visitor. This is because apache compiles all of the configuration data as soon as it starts. You can make adjustments like mod_rewrite rules based on the visitor's IP, or you can utilize mod_access.

Apache's "include" directive is only valid within the main configuration, or contexts. There's a bunch of documentation available on that directive.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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