How to Allow access only for IP range using htaccess (security tutorial)
The idea is to block access from all IPs, exept the range for yours, basically you cannot allow a range of IPs on the .htaccess using the "allow from", but you can emulate it with multiple CIDR networks IPs format.
Bellow is a .htaccess example to allow access only to IP range from 10.10.10.0 to 10.10.10.255, to specific folder
Order Deny,Allow
Deny from All
# Allow only for range 10.10.10.0 to 10.10.10.255 (the 24 in CIDR mean 255)
Allow from 10.10.10.0/24
Change the red ip address with your ip range, and copy the above lines to a .htaccess on the root of the folder you want to protect, to check your ip just write "my ip" on google search.
More examples:

Allow from 0.0.0.0/8
# Another one : 1.2.0.0 - 1.2.1.255
Allow from 1.2.0.0/23
# Allow small range : 1.2.3.0 - 1.2.3.3
Allow from 1.2.3.0/30
Thanks, and if you have any question leave a comment.
If you like this article, please share it on facebook, tweet it and +1 it to spread it :) !
How to Allow access only for IP range using htaccess (security tutorial)
Reviewed by Mhr
on
15:40
Rating:

No comments
No Backlinks please, Comments are under moderation !