Apache password set-up

They have: 2 posts

Joined: Apr 2001

Hi there,

I would like to know, if there is a more elegant way in restricting several directories from direct access via password protection. Right now there are 4 directories to be protected, and the way Apache is set up is, that I have the information (see below) 4 times in the server configuration file, of course with the correct folder info in each of them.

AuthName "restricted"
AuthType Basic
AuthUserFile /path/to/passwordfile
require valid-user

Now I wonder if there is a more elegant, sophisticated way in doing that. Is there the possibility to have the information for the folders all in one directive (is that the right word?) instead of 4 different ones? .htaccess files in every directory that should be protected are not an option right now. The directories to be protected are all below the site root.

TIA

Sabine

mairving's picture

They have: 2,256 posts

Joined: Feb 2001

Anife, welcome to Webmaster Forums!

There is not really another way to do this that I know of via Apache. Why are you using four different directories? Maybe explain what you are doing and I can help better.

Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states

They have: 2 posts

Joined: Apr 2001

Hm, thanks. At least I don't have to think about it any more Smiling.

Why 4 directories...
Well, right now we have the website set up in a way, that the index page should be accesible for the public.
I should mention that this site is not the entire corporate site, just a part of it (deals with customer support), and it also resides on it's own machine.
All links on that index page are, for the moment, only accessible for recent customers. Not all directories are linked to from that index page, 4 of them are. These four directories, containing info for specific products, have to be protected.
That type of structure may change soon, so that the entire site will be accesible only for customers through a specific portal page. That has to be determined...

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.