Default setting in Apache allows folder listing, which is not safe or secure and you may want to take below approach to change this setting.
A) "The best" approach is insert or change default tag within /etc/httpd/conf/httpd.conf as below:
B) It can be enabled or disabled by inserting below tag in .htaccess file at the website root or specified folder for example for Download and repository folder which user can select which file he/she wishes to download.
C) To do it website specific httpd.conf settings:
A) "The best" approach is insert or change default
<Directory /> Options -Indexes AllowOverride All </Directory>
B) It can be enabled or disabled by inserting below tag in .htaccess file at the website root or specified folder for example for Download and repository folder which user can select which file he/she wishes to download.
echo 'Options -Indexes' > /var/www/html/.htaccess
C) To do it website specific httpd.conf settings:
<VirtualHost *:80> Options -Indexes ServerName somewebsite.com ServerAlias www.somewebsite.com DocumentRoot /var/www/somewebsite.com </VirtualHost>
No comments:
Post a Comment