How to activate WordPress permalinks locally on a Mac

This is the kind of things that make me think: “Is it possible that no one on the Internet has had this issue?”. I found just partial answers and none of them worked (neither the ones provided on WordPress site, because you need to know exactly how to format paths and which directives you need). This should be a very common problem though.

So, to the benefit of anyone coming here through a search engine via the keywords “wordpress permalinks mac” this is how I managed to activate them after a long struggle.

  • This works on Lion, it should work with previous or later versions of the OS too. I used Textmate (with its terminal utilities installed) and Terminal.
  • In your WordPress admin panel select the kind of permalinks you like: copy the code and paste it into a TextMate plain text file. Save it as htaccess at the root of your local wordpress installation.
  • Open Terminal, locate your htaccess file and rename it .htaccess (mv htaccess .htaccess). I do these steps because I like to see things when I’m not working exclusively with Terminal, but of course you can do all of this in many other ways.
  • Now the ugly part: open /etc/apache2/httpd.conf (or /etc/httpd/httpd.conf if you’re on MacOS X 10.4 or earlier) and scroll to the bottom. Add these lines:
     <Directory /Users/your_username_here/Sites/my_wordpress_installation>
     Options FollowSymLinks
     AllowOverride All
     </Directory>
  • Do it on a site-by-site basis or it may mess up your other directories.
  • Save. It’s a read-only file, you will be asked to overwrite. Do it, at your own risk – I assume no responsibility at all for what you’re doing, I warned you.
  • Turn Web Sharing off and on again. Permalinks should work now.

Of course you can do all of this with Terminal and vi (or emacs, if you hate yourself).

Comments are closed. Linkbacks are open.

This is why comments are closed. A very brief comment? Tweet it to @cmgaston.