为什么Apache无法deny跳转的域名(次域名)?


如题,
系统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/$1 [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 (后面省略)

apache web centos

jobgene 9 years, 4 months ago

Your Answer