I'm attempting to deny access to anyone surfing for PHP files in a specific directory:
example.com/inc/
I've created an example.com/inc/.htaccess file with the contents:
Order deny,allow
Deny from all
This results in a 403 Forbidden response when I try to access one of the files. For example: example.com/inc/file.php
The problem is, my web server is also denied access and my application stops working.
How can I deny access to people surfing for such PHP files but allow my shared web server access?
Note: I'm using GoDaddy shared hosting.
file.php
and your web server accessingfile.php
.HTTP_REFERER
can be used probably but that is a very weak check. – anubhavafile.php
is via site's webserver only. Probably OP meant that there is some link tofile.php
on the website. – anubhava