How to Block IP Address in Magento (Magento1)

Industry:

There are many reasons why you might want to block certain users by IP address or block users from certain countries from reading, commenting, viewing or even purchasing a certain product.  For example, this user might be from a malicious country. The user’s ip address might a suspicious one.   Or the IP address might have been one that is linked to a user doing something bad in the past. So let’s talk about how to block IP address in magento. 

There are two main ways how to block IP Address in Magento.  One way is to purchase one of many modules that will allow you to add a list of  ip’s that you want to block.  Some will even let you block an entire country by country name.  These modules range in price from free to a few hundred dollars.  Obviously the more expensive the module the more features and blocking mechanisms it will have.  For example, some of the more expensive modules will allow  you to to do things like send a blocked IP Address to a CMS page or the maintenance page.  And, they can even perform actions like sending the user to a different url.

The most basic method on how to block IP Address in Magento is to modify the .htaccess file to deny access to certain IP’s.  You can only block IP address in Magento if your hosting gives you access to your .htaccess file.  This method is also just a simple allow or deny by IP address.  You can’t do anything more than that.  The code  to deny certain IP addresses is:

ip 1 300x196

<Directory>

order deny,allow

deny from 111.222.333.444

</Directory>

You can place this code anywhere in your .htaccess file.  Just make sure your hosting allows you to change you the .htaccess file and that the location of your .htaccess file is correct so it gets read into the site.

If you find you need expert help on how to block ip address contact Brian Wade at https://cybersolutions-llc.com.

 

 

case studies

See More Case Studies

Contact us

Partner with Us

We’re happy to answer any questions you may have and help you determine which of our services best fit your needs.

Your benefits:
What happens next?
1

We Schedule a call at your convenience 

2

We do a discovery and consulting meeting 

3

We prepare a proposal 

Schedule a Free Consultation
Simplifying IT
for a complex world.
Platform partnerships