0

I have multiple website on my server. In one of them I noticed i can see all the php files (and their code) of a folder.

The folder permissions are rwxr-xr-x (0755) and the files inside are rw-r--r-- (0644).

In my second website I have a similar folder and files with the same file permissions but there i get :

Forbidden

You don't have permission to access /myFolder/ on this server.

How is it possible? and what is the best way to set permissions so the website users can see the website but not a whole folder files?

Niv Apo
  • 983
  • 1
  • 9
  • 18

1 Answers1

1

Try with this in .htaccess file in that directory.

Options -Indexes

Info: deny directory listing with htaccess

Info: http://www.ducea.com/2006/06/26/apache-tips-tricks-disable-directory-indexes/

Nacho
  • 48
  • 9
  • Yeah that'll work but is that the only way a user can see my php files? through the directory listing? – Niv Apo Jun 20 '17 at 15:59
  • Or if the user has access to the server ... I do not remember another way that they can see your files ... it never happened to me: P – Nacho Jun 21 '17 at 08:29