Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: locate .htaccess file
PostPosted: Fri Sep 18, 2009 3:28 am 
Offline
Senior Newbie

Joined: Wed Sep 09, 2009 3:36 am
Posts: 6
WLM: pandya_milan@hotmail.com
Yahoo Messenger: pandya_milan82@yahoo.com
Hi,
I am noob on linux so sorry if this question sounds stupid.

I have installed apache2 on centos 5 using this tutorial (http://library.linode.com/lamp-guides/centos-5/).

I want to remove directory listing feature. that is, when someone, types http://mysite.com/abc/

He should not see files in that folder.

For that, there is a way to do in .htaccess,

Options -Indexes

I did grep -i AllowOverride httpd.conf and i got

Code:
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?

Thanks


Top
   
 Post subject:
PostPosted: Fri Sep 18, 2009 5:44 am 
Offline
Senior Newbie

Joined: Thu Apr 23, 2009 5:00 pm
Posts: 15
Hi there

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:

Code:
Options -Indexes


You could run these commands to get everything up and running...

Code:
touch /var/www/html/abc/.htaccess

Code:
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!! :)


Top
   
PostPosted: Tue Sep 22, 2009 3:01 am 
Offline
Senior Newbie

Joined: Wed Sep 09, 2009 3:36 am
Posts: 6
WLM: pandya_milan@hotmail.com
Yahoo Messenger: pandya_milan82@yahoo.com
Hi,
i created .htaccess in abc/

and changed

Code:
# AllowOverride controls what directives may be placed in .htaccess files.
    AllowOverride None


to

Code:
# 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.

Thanks czotos :)


Top
   
 Post subject:
PostPosted: Tue Sep 22, 2009 7:53 am 
Offline
Senior Newbie

Joined: Thu Apr 23, 2009 5:00 pm
Posts: 15
Hi mikeindia

I'm glad that helped!! :D


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group