如題,
系統centos 6.7 x32;
我在設定Apache(版本:Apache/2.2.31)的虛擬主機設定檔(httpd-vhosts.conf)的時候,加入了存取限制段和網域跳躍:
# access control
<Directory /data/www/>
Order allow,deny
Allow from all
Deny from 127.0.0.1
</Directory>
# jump
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.bbb.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.aaa.com$
RewriteRule ^/(.*)$ http://www.testweb.com/ [R=301,L]
</IfModule>
重啟Apache後,在 centos 裡用curl測試程式碼:
curl -x127.0.0.1:80 www.testweb.com -I #这个是返回 403的,没错
但是兩個次域名都能成功跳轉,顯示 301,按理說 deny 了127.0.0.1,怎麼次域名還能訪問? ? ?
curl -x127.0.0.1:80 www.bbb.com -I
# 结果:HTTP/1.1 301 Moved Permanently (后面省略)
curl -x127.0.0.1:80 www.aaa.com -I
# 结果:HTTP/1.1 301 Moved Permanently (后面省略)