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!




LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks