我正在尝试重定向,但出于某种原因,我使用下面的代码获取了一个apache错误页面
# -> Rewrite START
Options ExecCGI +FollowSymLinks
RewriteEngine On
ErrorDocument 403 http://example.com
### Deny website access to users outsdie our IP addresses
order deny,allow
deny from all
allow from xx.xx.xx.xx
allow from xx.xx.xx.xx
### Deny end
EDITED
有人可以指出我正确的方向。我是.htaccess的新手。我如何在下面的代码中添加另一个IP地址?
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !=xx.xx.xx.xx
RewriteRule ^(.*)$ http://example.com [L,R=301]
答案 0 :(得分:1)
由于循环,您收到错误,因为对403的请求也会导致403(因为IP仍会匹配)。
请尝试使用此代码:
Options ExecCGI +FollowSymLinks
ErrorDocument 403 /
RewriteEngine On
RewriteCond %{REMOTE_ADDR} !^(xx\.yy\.zz\.mm|aa\.bb\.cc\.dd)$
RewriteRule ^.+$ - [F]