Restrict access to a web page to a specific IP addresses, using .htaccess on Apache2
Overview
This guide will help you setup a .htaccess file that restricts access to a page only to specific IP addresses. You might find that useful if you want to protect you web platform adminstration panel or some web tools like phpMyAdmin.
Setup
The .htaccess files are a powerfull tool to control setting in Apache web server from the web directories. To secure a directory create a file named “.htaccess” within it or it’s parent directory.
To restrict the access to a folder from only one specified IP address or range you can use the following configuration:
order deny,allow
deny from all
allow from 10.0.0.1
You can add multiple ‘allow’ rules to whitelist multiple addresses. You can also use the network slash notation to allow an entire network or subnet, like this:
order deny,allow
deny from all
allow from 10.0.0.1
allow from 192.168.0.0/24
Stay in touch for more security tips on CloudBalkan.