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 configure access to only ONE file not to directory.
How to manage access with an IP Manager? Go to Hosting → Manage → IP Manager: There, you will be able to find 2 options: add IPs to allow and block access to your website: Just add an IP you wish to create rules for, leave a note (optional) and click on Add.
Step 1: Generate the Country's IP Addresses Select the countries you want to block or allow. On the Select Format section, choose Apache . htaccess Deny or Apache . htaccess Allow.
Blocking a country couldn't be easier. Just log in and go to 'Threat Control', then where it says 'Add custom rule', start typing the full country name and then click it from the dropdown list. Click the big red 'Block' button and you're done!
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With