How to have a whitelist of IP addresses that can access files in .htaccess

October 26, 2018

If you want Apache to only allow access to files/directories that match a set of IP addresses you can use this:

<Files admin_panel.php>
Order deny,allow
Deny from all
Allow from x.x.x.x localhost
</Files>

Remember to change admin_panel.php and X.X.X.X to your details