locate .htaccess file
I am noob on linux so sorry if this question sounds stupid.
I have installed apache2 on centos 5 using this tutorial (
I want to remove directory listing feature. that is, when someone, types
He should not see files in that folder.
For that, there is a way to do in .htaccess,
I did grep -i AllowOverride httpd.conf and i got
AllowOverride None # AllowOverride controls what directives may be placed in .htaccess files. AllowOverride None # AllowOverride FileInfo AuthConfig Limit # for additional configuration directives. See also the AllowOverride AllowOverride None AllowOverride None AllowOverride None
So, my question is
1) where do i find .htaccess file? (All, php and .html files are in var/www/html )
2) AllowOverride is None, so will my .htaccess file work?
You won't find the .htaccess file. You will need to create it in the directory that you do not want to have a directory listing.
I presume the directory is: /var/www/html/abc/
The .htaccess file is a normal text file and needs to contain only this information:
You could run these commands to get everything up and running…
echo "Options -Indexes" >> /var/www/html/abc/.htaccess
You will probably need to change the AllowOverride option in your httpd.conf file from AllowOverride None to AllowOverride All.
Save the httpd.conf file and restart the Apache service.
Try that and let us know if it helps!! :)
i created .htaccess in abc/
# AllowOverride controls what directives may be placed in .htaccess files. AllowOverride None
# AllowOverride controls what directives may be placed in .htaccess files. AllowOverride All
in httpd.conf file.
then restarted Apache (or did /etc/init.d/httpd reload)
and worked like a charm.