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, URLs">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:
ctrl-w to find ‘Override’. You need the second instance of the term so search twice. You should see:
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:
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:
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.