You are here: Blog » Code Snippets » Restrict Magento Admin Section To Specific IPs

Restrict Magento Admin Section To Specific IPs

d

It’s a good idea to add extra security protection to the admin section of a Magento site. The reason for this is that if a hacker gained access to your site’s admin section, they would be able to get your customers’ private information and obtain full control over your site. This would allow them take down your site completely, or make malicious changes to your site’s code that could harm your customers and website visitors.

One of the best approaches to securing the Magento admin section is to allow only specific IP addresses to reach the admin panel. The code below will allow you to do just that. You should add the code below to the .htaccess file in your root folder. Note that in my trials, the code worked best if added within the <IfModule mod_rewrite.c> tag, and that this <IfModule mod_rewrite.c> tag should preceed the existing <IfModule mod_rewrite.c> tag already in your Magento’s htaccess file.

The Code

In the code above, you should replace the !^12\.34\.131\.181 with whatever your IP address is. Add additional lines below for each desired IP address.

This entry was posted in Code Snippets and tagged by .

Author: justin saad

Justin Saad is first and foremost a husband and a father of four. He is also a web developer and designer who has been making websites for over twenty years. His company is called The Motech Network and his website is ClevelandWebDeveloper.com. In addition to building websites, Justin makes WordPress plugins and likes writing tutorials to help others learn about various aspects of web development.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">