View Single Post
  #2  
Old January 18th, 2002, 10:24 PM
Jadey's Avatar
Jadey Jadey is offline
sosumi
 
Join Date: Apr 2001
Location: CANADA
Posts: 771
Thanks: 0
Thanked 0 Times in 0 Posts
Jadey is on a distinguished road
How-to: password protect symbolic links through Apache

If you've created a symbolic link to a directory not normally served by apache, but want that directory to ask for a username & password, here is how you do it! This How-to assumes you've already followed my instructions above.

First (in case you haven't created the symbolic link), bring up a terminal. Type in the terminal:

ln -s /Users/username/Music /Library/WebServer/Documents/Music

Modify first path above to the directory you actually want accessible in your web site. Modify the second path if you prefer to serve it out of your own /Users/username/Sites/Music (for example). This is the directory you'd create your .htaccess file in, as described in the first post in this thread.

Now to protect that directory:

In terminal type:

cd /private/etc/httpd

sudo pico httpd.conf

Scroll down until you see a section that reads this:

# Control access to UserDir directories. The following is an example
# for a site where these directories are restricted to read-only.

Add these lines:

<Directory "/Library/WebServer/Documents/Music">
AllowOverride AuthConfig
</Directory>

Save the file, restart apache. Now when you go to http://localhost/Music you'll be prompted for your username & password and taken into your /Users/username/Music directory through Apache!

Last edited by Jadey; January 19th, 2002 at 11:13 AM.
Reply With Quote