Htacess - 限制网址与3个IP地址分开

时间:2017-02-16 11:45:31

标签: .htaccess ip-address restriction whitelist

我的magento管理商店有一个自定义网址,让我们说它是'日落'所以访问管理员的网址是:

www.mystore.com/index.php/sunset

www.mystore.com/sunset

我现在希望能够将此访问限制为仅3个IP地址,否则会重定向回主页。

我有像这样的htaccess代码,适用于单个IP:

RewriteCond %{REQUEST_URI} ^/(index.php/)?sunset [NC]
RewriteCond %{REMOTE_ADDR} !^11.333.22.33
RewriteRule ^(.*)$ https://%{HTTP_HOST}/ [R=302,L]

并且完美无缺。然而,当我尝试包括以下2个其他IP地址时:

RewriteCond %{REQUEST_URI} ^/(index.php/)?sunset [NC]
RewriteCond %{REMOTE_ADDR} !^11.222.33.444 [OR]
RewriteCond %{REMOTE_ADDR} !^11.222.55.444 [OR]
RewriteCond %{REMOTE_ADDR} !^11.333.22.33
RewriteRule ^(.*)$ https://%{HTTP_HOST}/ [R=302,L]

它允许任何人访问。

我错过了什么?

0 个答案:

没有答案
相关问题