I'm using Mac OS X's built in Apache + PHP with MySQL. Everything works perfectly, except for my pretty %postname% permalinks — they just won't work. I have obviously enabled mod_rewrite and set the AllowOverride setting to All on my httpd.conf file. In case there's anything I can do (I really don't want to run MAMP), is there any programmatic way to use default permalinks on localhost using the very same template files?
2 Answers
Your /etc/users/{username}.conf should look like this:
<Directory "/Users/username/Sites/">
Options Indexes MultiViews FollowSymLinks
AllowOverride All AuthConfig
Order allow,deny
Allow from all
</Directory>
You also have to change the name Apache runs under to be able to save the .htaccess rules and use the media uploader etc...
<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
User chris
Group admin #or you can use staff
</IfModule>
</IfModule>
The AllowOverride is listed a couple of times in httpd.conf make sure you changed the right one or both. One is the default setting and the other is for Library/WebServer/Documents which you should change to whatever server document root your using.
Apache has to be restarted for any changes to take affect. sudo apachectl restart
Also see How to Install Apache and PHP on Mac OSX for more details.
-
Thanks, Chris! One question, though: where should I add that second <IfModule> code? Right after the first one, inside my .conf user file?– JoãoApr 26, 2011 at 21:12
-
It should be already there towards the beginning of the file with the user and group set to _www. It's surrounded by comments that I removed to paste in here.– Chris_OApr 26, 2011 at 21:25
there are two conf files for the built in apache, one for your username, which may be setting allowoverride to none.
-
Thanks, Milo. I just got to /etc/users/[username].conf and set AllowOverride to "All" as well. Let me reboot and see if it works already.– JoãoApr 26, 2011 at 16:32
-
-
-