htaccess允许多个主机

时间:2014-09-26 12:11:57

标签: php .htaccess

我正在使用以下代码,但它不起作用:

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REMOTE_HOST} !^arc14.pip.aber.ac.uk [OR]
RewriteCond %{REMOTE_HOST} !^jas31.pip.aber.ac.uk
RewriteCond %{REQUEST_URI} !/soon\.php$
RewriteRule (.*)$ /soon.php [R=302,L]

但这样做:

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REMOTE_HOST} !^arc14.pip.aber.ac.uk
RewriteCond %{REQUEST_URI} !/soon\.php$
RewriteRule (.*)$ /soon.php [R=302,L]

我想允许两个,我该怎么做?

2 个答案:

答案 0 :(得分:0)

继续添加更多RewriteCond %{REMOTE_HOST}

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REMOTE_HOST} !^arc14.pip.aber.ac.uk
RewriteCond %{REMOTE_HOST} !^someplace.somewhere.com
RewriteCond %{REMOTE_HOST} !^whatever.anything.edu
RewriteCond %{REMOTE_HOST} !^idk.what.else
RewriteCond %{REQUEST_URI} !/soon\.php$
RewriteRule (.*)$ /soon.php [R=302,L]

答案 1 :(得分:0)

创建.htaccess文件并编码以下行。

order deny,allow
deny from all
allow from <Give YOUR IP>,<Give YOUR IP>,<Give YOUR IP> and so on...