How to Allow or Disallow A Customer to Access Customer Area of Magento

If you use Nginx, and Linux systems for your web hosting, modify nginx.conf, and add the following code to the proper place.

location ~* ^/customer {
    deny 159.138.135.247                   
    deny 150.109.119.72                    
    deny 222.186.180.198                   
    deny 182.92.122.79                     
    deny 222.186.31.109                    
    deny 139.196.188.227                   
    deny 116.196.105.57                    
    deny 182.254.156.93                    
    deny 101.132.119.42                    
    deny 47.106.250.53                     
    deny 154.8.218.155                     
    deny 119.8.40.215                      
    deny 150.139.223.182                   
    deny 111.20.246.22                     
    # include ./block_chinese_russia_ips_nginx.conf;
 
    try_files $uri $uri/ /index.php?$args;
    location ~* \.php$ { try_files /dummy @proxy; }
    allow all;
} 

If you use Apache and Linux systems for your web hosting,

Create a folder named “customers” under your Magento 2.4 based shop, under the newly added folder, create a file named .htaccess, and add the following code:

deny from 178.200.140.115                   
deny from 63.143.86.253                     
deny from 47.100.119.206                    
deny from 139.196.187.131                   
deny from 114.215.186.225                   
deny from 42.51.55.157                      
deny from 188.174.50.141                    
deny from 81.68.161.133                     
deny from 119.8.236.111                     
deny from 58.97.163.162                     
deny from 139.9.159.251                     
deny from 143.92.60.103                     
deny from 112.35.126.153                    
deny from 116.63.190.160
Published
Categorized as Magento