配置如下
<Directory /data/www/>
Order allow,deny
Allow from all
Deny from 172.168.1.160
</Directory>
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.456.com$
RewriteRule ^/(.*)$ http://www.123.com/$1 [R=301,L]
</IfModule>
当禁止本地访问/data/www时,
#curl -x127.0.0.1:80 ‘http://www.456.com/1.txt‘
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="http://www.123.com/1.txt">here</a>.</p>
</body></html>
#
因此,301跳转的优先级较高于403禁止
本文出自 “linux基础” 博客,请务必保留此出处http://chaoyuezhangsan.blog.51cto.com/7176886/1733604
原文地址:http://chaoyuezhangsan.blog.51cto.com/7176886/1733604