SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
-
Apr 13, 2005, 03:22 #1
- Join Date
- Apr 2005
- Posts
- 5
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Apache, aliases, htdocs & dynamic directories
Hello all,
As this is a first post I apologise for any cardinal rules that I might break
I have Apache 2.x running on a windows box that is serving pages from C:\Apache\HTDOCS. In the conf file I have specified an alias to another directory (C:\AppLogs\) by using the following lines :
Code:Alias /AppLogs/ "C:/AppLogs/" <Directory "C:/AppLogs"> Options Indexes MultiViews AllowOverride None Order allow,deny Allow from all </Directory>
Now this all works fine (I can live with the 404 errors when the directory doesnt exist), but I need to password protect this directory using htaccess.
My understanding is that I need to place a .htaccess & .htpasswd file into this directory, but as mentioned above this directory is dynamic and the application that works on it isnt capable of generating these files.
So the question is : Is there anyway I can specify password protection for that alias directory without placing anything into it?
-
Apr 13, 2005, 05:53 #2
- Join Date
- Dec 2003
- Location
- world wide
- Posts
- 32
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I never worked with apache/windows so far, but I suppose the same rules apply.
You can put the config in your httpd.conf like:
<directory c:/applog>
AuthUserFile c:/.htpasswd
AuthName Something
AuthType Basic
require valid-user
</directory>
the .htpasswd file needs to be outside of applog so that
you won't have to recreate it after the directory gets deleted.
-
Apr 13, 2005, 09:05 #3
- Join Date
- Apr 2005
- Posts
- 5
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Based on your post I have found a solution :
I have added this to the httpd.conf file
Code:Alias /AppLogs/ "C:/AppLogs/" <Directory "C:/AppLogs"> Options Indexes MultiViews AllowOverride None Order allow,deny Allow from all AuthName "Log Viewer Login" AuthType Basic AuthUserFile "c:/apachessl/conf/passwd.txt" require valid-user </Directory>
Apparently this is the recommended method of perform authentication if you have access to the conf file as it is less intensive
Bookmarks