How to restrict Directory Access by IP address

How to restrict Directory Access by IP address

In order to secure your "admin area" from hackers, we recommended you to allow access only from your selected IP to your admin directory. You just need to create an .htaccess file in the directory where you want to restrict access by IP Address.

For example, if you have a WordPress blog installed on your main directory like example.com/wp-admin, you should create an .htaccess file in /wp-admin/.htaccess and you should put this code in, and not forget to replace the allowed IP address with your IP address.

  • order deny,allow
  • deny from all
  • allow from IP-ALLOWED

  • (Replace "Your-IP-Address-Here" text with your IP Address)

    You can test this by accessing your-domain/wp-admin, from an IP address other than the one allowed by your .htaccess file.


      • Related Articles

      • How to blacklist a IP address

        You can block access to a directory with a password using the "IP Blocked" cPanel. 1. Sign in to your cPanel account. 2. In the "Security" section, click the "IP Blocker" icon. 3. In "Add an IP or range" you must enter the IP address you want to ...
      • How to block any IP address

        You can block any IP address by add this line to your .htaccess file: order allow,deny deny from IP-ADDRESS allow from all Replace "IP-ADDRESS" with the IP Address you want to block.
      • Remote Dtabese Access

        Add a specific domain name or IP to allow visitors to connect to MySQL databases. Step 1Logged into your cPanel in the “Database” section, locate the “Remote MySQL” item. Step 2 Now enter the hostname (domain, server or IP address). The wildcard ...
      • First steps with the Hosting: access

        When you receive the access information by email, you can do the access to the hosting service with the access information include in the email. You can access the hosting service panel (cPanel) in two ways.       1. The first one is by the client ...
      • How to disable directory browsing

        For security purposes, we recommend that you disable navigation in the directory on your website so that you cannot see the files/pastes of your website. First you need to access your cPanel Step 1 After accessing your cPanel, go to the Files section ...