FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Need help with httpd.conf and .htaccess





ammonkc
I'm trying to deny directory listing of my images directory on my apache server. I'm running a LAMP server on RedHat. Putting IndexIgnore * in my .htaccess file didn't seem to work. but putting Options -Indexes did work.

Did not work:
Code:

IndexIgnore *


This is what the directives in my httpd.conf file looked like:
Code:

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

<Directory "/usr/local/apache/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride All
    Order Allow,Deny           
    Allow from All
</Directory>


I added this to my httpd.conf and .htaccess file and it Did work:
Code:

<Directory "/usr/local/apache/htdocs/image">
        Options Indexes FollowSymLinks
        AllowOverride All     
        Order Allow,Deny
        Allow from All
</Directory>

Code:

Options -Indexes


I'm pretty sure that having to add directives to my httpd.conf file for every directory that I was to control isn't the best practices for server administration. How should I have it set up so that I can control different directories with the .htaccess file. Thanks in advanced
bladesage
First of all, I don't see how this is related to PHP and MySQL.

More to the point, you should be able to put Options -Indexes into any .htaccess file and have it work. That is the way you are expected to do so.

Secondly, by using a .htaccess file in any directory, it will also apply to all subdirectories inside it. If you place a .htaccess file into your home directory (ie. htdocs), and add Options -Indexes to it, you should get that to apply to all of your directories.

As long as the httpd.conf file is set to AllowOverride All, you should be able to do so in any directory you choose. You should (theoretically) even be able to restrict indexes on all directories by changing to the following:
Code:
<Directory "/usr/local/apache/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride All
    Order Allow,Deny           
    Allow from All
    Options -Indexes
</Directory>
ammonkc
Thanks. Sorry about posting this in the php mysql section. For some reason I thought that I was in the apache section.
Related topics
Can someone help me ? Com domain setup?
Auto redirect your visitors to a different page
Easy PHP installation
simple webserver on cable line.
creating error pages
.html using header/footer include script?
help to configure apache2 and mod_python [NOT SHORT]
[help] Ayuda con .htaccess
php instalation:
Website login- How?
General .htaccess tutorial.
Im using apahe,php, and mysql and dreamweaver (HELP)
Apache
Edit httpd.conf?
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.