只允许公司IP访问指定目录,不符合的条件返回404页面。
<VirtualHost *:80> ServerName sg.com DocumentRoot /var/www/sg.com ErrorLog /var/log/httpd/sg.com.error.log CustomLog "|/usr/sbin/rotatelogs /var/log/httpd/sg.com.access.log 86400" combined <directory /var/www/sg.com> AllowOverride All </directory>
# <Location /> # Order Allow,deny # AuthType Basic # AuthUserFile /etc/homm_htpasswd # AuthName "accman" # Require valid-user # Allow from 112.65.136.170 # Satisfy Any # </Location> RewriteEngine on RewriteCond %{REQUEST_URI} ^/admin/(.*)$ [NC] RewriteCond %{REMOTE_ADDR} !^112.65.136.x$ RewriteRule . %1 [R=404,L] #ErrorDocument 404 /admin
# <Location /> # Order Allow,deny # AuthType Basic # AuthUserFile /etc/homm_htpasswd # AuthName "accman" # Require valid-user # Allow from 112.65.136.x # Satisfy Any # </Location> </VirtualHost>
|