Out of the box, the Apache Web server that comes with OS X does not take any notice of .htaccess files (used to set passwords, rewrite URLs, point to custom error pages, etc). It took me a while to figure out how to get them working, so I’ve posted this for Google to soak up. Thanks to Jeremy and MacOSXHints for some pointers along the way.
The first step to getting .htaccess working is to edit your httpd.conf file. Open the Terminal, go to the Apache config directory and open httpd.conf. You will need to supply your admin password:
cd /private/etc/httpd/ sudo pico httpd.conf
ctrl-w to find ‘Override’. You need the second instance of the term so search twice. You should see:
# This controls which options the .htaccess files in directories can # override. Can also be "All", or any combination of "Options", "FileInfo", # "AuthConfig", and "Limit" # AllowOverride None
Change the setting to
AllowOverride All then exit and save. At this point one would think the job is done, but each user has a conf file that would need changing too. Back in the terminal, move into the users directory and get a file listing:
cd users ls
You should see a .conf file for each user on the system. As before, open the conf file for your username and change AllowOverride to AuthConfig:
sudo pico Clagnut.conf <Directory "/Users/Clagnut/Sites/"> Options Indexes MultiViews AllowOverride AuthConfig Order allow,deny Allow from all </Directory>
Exit, save and restart Personal Web Sharing in your System Preferences. Your .htaccess files should now work. I don’t know the ins and outs of Apache under OS X so I’m not sure of the security implications here, but if, like me, you only use Personal Web Sharing for local development I don’t see any issues.
Fatal error: Call to a member function getAttribute() on a non-object in /home/clagnutc/public_html/includes/thirdparties.inc.php on line 97