SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    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>
    The C:\AppLogs directory is created/destroyed by another application that runs on the server so sometimes this directory will not exist.

    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?

  2. #2
    SitePoint Enthusiast
    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.

  3. #3
    SitePoint Member
    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>
    "c:/apachessl/conf/passwd.txt" is my password file generated by the htpasswd tool

    Apparently this is the recommended method of perform authentication if you have access to the conf file as it is less intensive


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •