| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
|
|
#1 (permalink) |
|
knocking heads
Join Date: Jul 2003
Location: London, UK
Posts: 1,914
|
HTACCESS password protect directory
I've been developing our "Default Folder Structure" for a number of years now (which contains folders, files, code snippets, images etc which are used in every project) We now have a new requirement to password protect a specific directory in this folder structure for every new website, I've got this working by creating a .htpasswd file with a generic username/password and a .htaccess file which points to the correct file Code:
The only problem with this method is that we have to change the username each time we create a new site ("boldpoin" in this case). I've tried the following but it is no longer finding the .htpasswd file - am I close or missing something by using %{DOCUMENT_ROOT}? Code:
p.s i tried it with and without the trailing slash after the %{DOCUMENT_ROOT} |
|
|
|
|
|
#6 (permalink) |
|
hmmm...
Join Date: Jan 2004
Location: Yorkuk
Posts: 2,127
|
"The AuthUserFile directive sets the name of a textual file containing the list of users and passwords for user authentication. File-path is the path to the user file. If it is not absolute (i.e., if it doesn't begin with a slash), it is treated as relative to the ServerRoot." Apache module mod_auth |
|
|
|
#7 (permalink) |
|
knocking heads
Join Date: Jul 2003
Location: London, UK
Posts: 1,914
|
interesting, thanks... made me think in a different direction (although still not working) Code:
|
|
|
|
#13 (permalink) | |
|
shiro
Join Date: Aug 2007
Location: Yokohama, Japan
Posts: 2,605
|
Quote:
I dont know what it does (well actually I do know cause I read the post before this), but what I do know is that the little squiggly thing is called a tilda. My random knowledge of the minute. |
|
|
|
|
#16 (permalink) |
|
Senior Member
Join Date: Sep 2006
Location: Glasvegas
Posts: 865
|
2 things i don't get: why don't you have a global .htpasswd in server root, or /etc/htpasswd or somewhere? fyi storing .htpasswd files beneath doc root isn't exactly safe... why aren't you pushing new user:password combinations on to it during skeleton generation? even using your structure, why can't you generate the files containing the correct information as part of your setup script? it would be simple in any language ok, 3 things meh.
|
|
|
|
#17 (permalink) |
|
knocking heads
Join Date: Jul 2003
Location: London, UK
Posts: 1,914
|
1) because not all our sites are hosted in the same place and hosting that the client buys seperately often doesnt allow root access 2 & 3) we don't have a script for generating a skeleton (as there's no need for this) - it's simply a collection of files/folders |
|
|
|
#18 (permalink) |
|
Senior Member
Join Date: Sep 2006
Location: Glasvegas
Posts: 865
|
1 fair nuff - assumed this was a location controlled by yourselves, and we all know assumption makes... 2/3 that's what a skeleton is... i say tomahtoe... looking @ the docs i don't believe mod_auth can access env vars if it's any consolation it's annoying the fuck out of me now too, haven't dealt much with apache conf nightmares of late ok, you said having the .htaccess & .htpasswd in the same dir doesn't work, am i right saying that? because it works for me Code:
meh.
Last edited by proc355 : 28-09-2007 at 06:08. |
|
![]() |