To restrict directory access by IP address you need to follow the steps given below:
Create a file or open a file .htaccess(started with a dot) inside the directory that you want to protect.
Add the code given below to the file:
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
Instead of 127.0.0.1 in the above example you will write the IP address that you want to allow.
You can also give partial IP address, for example: 127.0.0 allowing a range of addresses to access the directory or you can also give multiple IP addresses separated with comma.
If comma separation is now working then you can allow multiple IP addresses to access the directory by adding the following lines as follows:
Allow from 127.0.0.1
Allow from 127.0.0.2
0 Comment(s)