Thursday, February 12, 2015

apache 2.2 - .htaccess & httpd.conf



I'm trying to get the directories in my /var/www/html/ directory to not show the "index of..." and all files residing in it. Do I need to edit httpd.conf and put .htaccess files in each directory to ensure the contents are hidden? I have Apache version 2.2.3 on CentOS 5.



Is this the part of httpd.conf I need to edit?




AllowOverride None
Options IncludesNoExec
AddOutputFilter Includes html

AddHandler type-map var
Order allow,deny
Allow from all
LanguagePriority en es de fr
ForceLanguagePriority Prefer Fallback



Do I put a .htaccess file with this in each directory?




Options -Indexes 

Answer



If you can edit the main config file then add -Indexes to your Options line



Options IncludesNoExec -Indexes


and restart your apache service.




It's doing this because there is no DirectoryIndex file. You could just put a blank index.html file in your directory. You could add the -Indexes to a .htaccess too.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...