Preventing directory access with htaccess

Matthew Burgess ca9mbu at eos.sunderland.ac.uk
Thu Feb 20 09:06:23 PST 2003


"Björn Lindberg" <d95-bli at nada.kth.se> wrote in message
news:hcsd6lmc39e.fsf at fnatte.nada.kth.se...
> I want to prevent access to a subdirectory on an Apache server. I
> can't set stricter permissions on the dir itself, because I keep
> pictures in there which other pages references, along with other
> data. Right now, I have temporarily solved it by putting a blank index
> page in the directory, but I would rather have something so that the
> server shows an error message instead.
>
> I think it could be done with the right .htaccess file, but I don't
> know the right commands for it. I do know how to password protect a
> dir, but this is different. Anybody who knows?

>From the FAQ (no need to play with .htaccess):
http://httpd.apache.org/docs/misc/FAQ-E.html#indexes
----
To turn on automatic directory indexing, find the Options directive that
applies to the directory and add the Indexes keyword. For example:

  <Directory /path/to/directory>
     Options +Indexes
  </Directory>
To turn off automatic directory indexing, remove the Indexes keyword
from the appropriate Options line. To turn off directory listing for a
particular subdirectory, you can use Options -Indexes. For example:

  <Directory /path/to/directory>
     Options -Indexes
  </Directory>


Regards,

Matt


-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe lfs-chat' in the subject header of the message



More information about the lfs-chat mailing list