当前位置: 动力学知识库 > 问答 > 编程问答 >

php - htacess allow multiple hosts

问题描述:

I am using the following code and it doesnt work:

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]

but this does:

Options +FollowSymlinks

RewriteEngine on

RewriteCond %{REMOTE_HOST} !^arc14.pip.aber.ac.uk

RewriteCond %{REQUEST_URI} !/soon\.php$

RewriteRule (.*)$ /soon.php [R=302,L]

I want to allow two, how can i do this?

网友答案:

Continue to add more RewriteCond %{REMOTE_HOST} lines

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]
网友答案:

Create .htaccess file and code the following lines.

order deny,allow
deny from all
allow from <Give YOUR IP>,<Give YOUR IP>,<Give YOUR IP> and so on...
分享给朋友:
您可能感兴趣的文章:
随机阅读: