I need to deny access to all users except 127.0.0.1 to one of my PHP files. I've tried using the following snippet in my .htaccess
file:
<Files /file.php>
Order deny,allow
Allow from 127.0.0.1
Deny from all
</Files>
…but that isn't working, so I'm looking for a solution without .htaccess
. Preferably I want a snippet that I can insert at the top of the page to determine whether the user is localhost or not. If they are not, it will send a 403 error and stop the page from continuing. How could I write such a thing?