Mac OS X, Web Sharing / Apache, and Symlinks
Mac OS X comes with an Apache installation which is very handy, but by default it’s configured not to follow symlinks. A lot of times I have projects in other directories which I want to share via the web server, but end up getting errors such as the following:
Forbidden
You don't have permission to access /~tlrobinson/Editor/ on this server.
And in the error log file:
[Wed Jun 25 16:17:14 2008] [error] [client ::1] Symbolic link not allowed or link target not accessible: /Users/tlrobinson/Sites/Editor
To enable following of symlinks, edit your account’s configure file located at /private/etc/apache2/users/username.conf
Here’s the default:
<Directory "/Users/tlrobinson/Sites/">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
You can either add “FollowSymLinks” to the Options directive (”Options Indexes MultiViews FollowSymLinks”), or change the AllowOverride directive to “All” (”AllowOverride None”) and place a .htaccess with it’s own Options directive (”Options FollowSymLinks”) in your Sites directory.
Then just restart Apache (”sudo apachectl graceful”) and symlinks should work.