I am using PHP as my backend to develop the site, it contains a lot of files and directory. if the structure of my file is visible to the third person it can be easily hacked. So it is necessary to hide those directory form the user view.
I actually search many times on google and found one case
Disable the directory listing shown in the browsers window if there is no any index.html, index.php like files like this screenshot on enabling directory listing.
I have successfully get rid of this problem just including these lines in the .htaccess file.
Options -Indexes IndexIgnore *
Now, What I actually want is not to show the directory in the source of the browser after inspecting like this image.
But I don’t want to show these directories to the user like https://www.bbc.com/ here I found that only (index) not other directories.
Thanks in advance ..
How you enable directory listing depends on the type of server you’re running. See the examples below and click on each server type for more information.
Apache: If apache detects any files in the directory such as:
default.php, etc., it will load them and not display the list of files.
This list can be configured with the
If none of these files are detected, the directory listing will be shown as long as the
+Indexes option is set for the directory. For example:
<Directory /usr/local/apache2/htdocs/listme> Options +Indexes </Directory>
autoindex on; for the desired directory in your config file.
IIS: On the command line, enter:
appcmd set config /section:directoryBrowse /enabled:true