HTML and CSS Reference
In-Depth Information
the Finder (once you're in the Finder, the Command+Shift+H keyboard shortcut will take
you directly to your Home folder) and create a new folder called Sites. This is where you'll
create your web files.
The editing of the httpd-userdir.conf file isn't necessary on OS X prior to Mountain Lion.
Now upon restarting Apache (with the apachectl graceful command), Apache will
immediately recognize your folder, but if you try to access it through a web browser, you'll
get an error. The reason for this is Apache has very restrictive default directory settings as
a security precaution. To override this for user directories you need to edit the httpd-user-
dir.conf file. To open the file for editing, use this command:
$ sudo nano /etc/apache2/extra/httpd-userdir.conf
You may or may not be prompted for your password depending on when you last used
sudo .
Once the httpd.userdir.conf file is open, scroll to the bottom and add the following:
<Directory "/Users/*/Sites/">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
Exit nano as you did before saving the revised httpd.userdir.conf file.
In short, this bit of code tells Apache that it has permission to look and serve content from
any user's Sites folder.
To test everything and make sure it all works, type the following at the terminal prompt:
$ echo "<? phpinfo() ?>" > ~/Sites/test.php
$ sudo apachectl graceful
Search WWH ::

Custom Search