Forum Moderators: phranque

Message Too Old, No Replies

.htaccess in linux

         

bbxrider

6:01 pm on Jun 24, 2010 (gmt 0)

10+ Year Member



this is the first linux apache I'm working with, have experience with apache on windows. so, the root directory is var/www/html, to deny directory listings, with VI, I created a .htaccess in the root directory with these contents:
# apache options for general website and joomla
#
# disable viewing directory contents
Options -Indexes

note that is a blank line after the options -indexes directive, issued a apachectl graceful but the site is still putting out the directory listing?
doesn't the .htaccess 'override' the httpd.conf directives?

encyclo

6:17 pm on Jun 24, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If this is a new installation of a dedicated server, you will first need to check the
AllowOverride
in your main Apache configuration. The precise location of the configuration file depends on your Linux distribution as well as the method you chose to install Apache.

In short, you will probably see a
<Directory /var/www/>
section which has a
AllowOverride None
- this needs to be changed to
AllowOverride All
instead. Note that if you want to disallow indexes site-wide, you can also disallow indexes in the main configuration file, thus negating the need to have a .htaccess directive.

If you're using Ubuntu, check the default entry in the
/etc/apache2/sites-available
directory, then restart Apache.

OT: you don't have to use /var/html either - if this is a test server, you can set up virtual hosts and keep the files in your home directory instead.

bbxrider

6:44 pm on Jun 24, 2010 (gmt 0)

10+ Year Member



I have the override directive twice in httpd.conf, first one;
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>

second one within this section
<Directory "/var/www/html">

is the first one site wide? and second would be the default site only?

jdMorgan

10:48 pm on Jun 24, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, the first one is Apache-server-instance-wide, and the second applies only to directories in the /var/www/html path.

Jim

bbxrider

12:28 am on Jun 25, 2010 (gmt 0)

10+ Year Member



ok thanks