如何限制管理员网址访问某些IP地址

时间:2019-08-26 13:16:43

标签: .htaccess authentication admin magento2

我正在研究Magento2。根据要求,我想将管理URL限制为某些IP,其余应可访问。从用于Htaccess方法的StackOverflow中尝试了多种解决方案,但这些解决方案都不适合我。

使用Apache 2.4和Magento 2.3版

RewriteCond %{REQUEST_URI} ^/(index.php/)?admin [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]

某些Ip应该可以访问管理URL。

1 个答案:

答案 0 :(得分:0)

尝试在.htaccess文件中尝试以下代码

<Directory>
order deny,allow
deny from  125.xx.10x.11x
</Directory>

注意:,其中 125.xx.10x.11x 您要限制的IP地址。

参考网址:

   1. https://www.mageplaza.com/kb/restrict-access-magento-2-admin.html         
   2. https://bobcares.com/blog/magento-block-ip-address/

我希望它将对您有帮助... !!!