[Typo3-linux] htaccess and directories

Dimitri Tarassenko mitka at mitka.us
Mon Oct 3 20:58:16 CEST 2005


Patxi,

On 10/3/05, Patxi Goitia <pgoitia at euskalnet.net> wrote:
> Hi, I'm trying to configure the htaccess I have in the root of my site
> to restrict access to several directories. I want to do that by using
> allow / deny to give access to those directories only to LAN ips.
>
> Until now, I had a htaccess file in each directory.
>
> I want to do all this job only from 1 htacces file, but I'm unable to
> find the way to do it...
>
> Any idea ?

Here is the deal - AuthType directive is only supported in <Directory>
and .htaccess contexts. Unfortunately, you can't nest <Directory> in
.htaccess file, the <Directory> container can only be placed within
<VirtualHost> container. In other words, you have 2 options:

1. keep everything as is
2. Move Auth* declarations from your .htaccess files into <Directory>
containers in your <VirtualHost> config, i.e. kind of like this:

<VirtualHost *>


    <Directory / >
        AuthType Basic...
   </Directory>

   ....
</VirtualHost>

#2 is actually going to deliver better performance, since .htaccess
files are read on every request and <VirtualHost> configs only on
restart/reload.

Don't forget that .htaccess are "workarounds" made primarily for mass
hosting. If you have full control over the server (or at least your
virtual host config) there is very little sense in using them.

--
Dimitri Tarassenko


More information about the TYPO3-linux mailing list