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

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
share|improve this question

1 Answer 1

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.

share|improve this answer

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.