Summary
The module mod_access provides access control based on a client's hostname or IP address.
Directives
Module: mod_access | |
Syntax: allow from all | env=[!]envvar | host [host ...] | |
Default: none | |
Context: directory, .htaccess | |
Override: Limit | |
Origin: Apache | |
Example: allow from all | |
Example: allow from env=go_away | |
Example: allow from 10.10.10.10 .ibm.com |
The Allow directive affects which hosts can access a given directory.
The allow from env option controls access to a directory by the existence (or nonexistence) of an environment variable. For example:
BrowserMatch ^KnockKnock/2.0 let_me_in <Directory /docroot> order deny,allow deny from all allow from env=let_me_in </Directory>
In this case browsers with the user-agent string KnockKnock/2.0 will be allowed access, and all others will be denied.
Module: mod_access | |
Syntax: deny from all | env=[!]envvar | host [host ...] | |
Default: none | |
Context: directory, .htaccess | |
Override: Limit | |
Origin: Apache | |
Example: deny from env=go_away | |
Example: deny from 10.10.10.10 .ibm.com |
The deny directive affects which hosts can access a given directory.
The deny from env option controls access to a directory by the existence (or nonexistence) of an environment variable. For example:
BrowserMatch ^BadRobot/0.9 go_away <Directory /docroot> order allow,deny allow from all deny from env=go_away </Directory>
In this case browsers with the user-agent string BadRobot/0.9 will be denied access, and all others will be allowed.
Module: mod_access | |
Syntax: order ordering | |
Default: order deny,allow | |
Context: directory, .htaccess | |
Override: Limit | |
Origin: Modified | |
Example: order deny,allow |
The order directive controls the order in which Allow and Deny directives are evaluated. .
Keywords may only be separated by a comma; no whitespace is allowed between them. Note: that in all cases every allow and deny statement is evaluated, there is no "short-circuiting". For Example:
order deny,allow deny from all allow from .ibm.com
In this example, the first container's intent is to keep everyone out. The next container overrides for the appropriate subdirectory.
<Directory/> Order deny,allow deny from all allow from none </Directory> Alias /root /bobtest/xyz/html <Directory /bobtest/xyz/html/> Order allow,deny allow from all Authtype Basic AuthName "root and %%SYSTEM%%" PasswdFile %%SYSTEM%% Require valid-user UserID %%SYSTEM%% </Directory>
Hosts in the ibm.com domain are allowed access; all other hosts are denied access.