I have a website hosted in the directory: /var/www/website.com .
This directory and all its subfolders allow you to execute PHP code. However, I would like to prevent the PHP files that are in a specific folder ( /var/www/website.com/subfolder ) from accessing the parent folder and listing its files.
Example: A PHP function, such as scandir() , should contain a list of all folders, subfolders and files located in ( /var/www/website.com/subfolder ), but it is NOT allowed to list files below this level.
Do you know how this behavior can be implemented (preferably with Nginx)?
source share