1

So I have www.mydomain.com

Under that domain I have a directory, lets call it www.mydomain.com/secrets

I have php scripts that access stuff in the /secrets directory (zip files mainly), how could I make all files in that directory still work with the php scripts but if someone went to www.mydomain.com/secrets/file.txt they wouldn't see the file.

APW
  • 29
  • 3

1 Answers1

3

Assuming you're using Apache (I haven't seen an installation of PHP with cPanel that doesn't have it, but I might not be so worldly), then .htaccess file in the specific directory is a good bet.

Create a file named .htaccess inside the directory where you want to restrict public access, and give it the following contents:

If on Apache 2.2

Order deny,allow
Deny from all

If on Apache 2.4

Require all denied
RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
e_i_pi
  • 4,590
  • 4
  • 27
  • 45