How to allow access to file only to users with ip which are in a range of ip addresses?
For example file admin.php. and range from 0.0.0.0 to 1.2.3.4.
I need
Just add a FilesMatch or Files directive to limit it to a specific script.
The following would block acces to all scripts ending in "admin.php" :
<FilesMatch "admin\.php$">
Order deny,allow
Deny from all
Allow from 10.0.0.0/24
</FilesMatch>
The following would ONLY block admin.php :
<Files "admin.php">
Order deny,allow
Deny from all
Allow from 10.0.0.0/24
</Files>
For more information refer to the apache docs on Configuration Sections.