Welcome to WebmasterWorld Guest from

Forum Moderators: bakedjake

Message Too Old, No Replies

htaccess or something else?

Secure directories dynamically.



11:11 am on Apr 10, 2003 (gmt 0)

Hi there,

Just came across this website and it looks like a great resource.

I have lots of URL's on my server and some of these URL's contain a directory called "/secure/pr".

What I need to do is to be able to secure this directory dynamically.

I was thinking about .htaccess, but that would involve putting a new .htaccess in each directory.

Ideally, I would like to add something to the server config, which says "Any request to a dir named 'pr' should be put through the mill and only allowed in if the IP address matches one in the list or a correct user and pass are given"

New sites are added all the time and the list of IP's and usernames passwords would change. This is where I think it is nto a good idea to use htaccess.

Any ideas?

Thanks in advance,

Mike Pearce


10:28 am on Apr 16, 2003 (gmt 0)

10+ Year Member

if you put this :

<LocationMatch "^.*/secure/pr/.*$">
AuthType Basic
AuthName "Secret"
AuthUserFile /var/www/somewhere/.htpasswd
Require valid-user

in your apache.conf, then any requests for /secure/pr would have password auth. this will work across all virtual domains.


Featured Threads

Hot Threads This Week

Hot Threads This Month