WordPress and permalinks and Mac OS X

I’m playing around with a WordPress installation on my laptop for a project, and had a hell of a time getting permalinks to work properly. I figured that my experience might be worth documenting for anyone else who’s playing around with Mac OS X.

I should note that I had to start from the beginning for this installation—I had to install MySQL using Fink, futz around with it until I got it starting reliably and was able to create a database for WordPress, then I had to enable PHP in the Apache httpd.conf file. At that point I was able to run the WordPress installation script and start tweaking options. But permalinks weren’t working.

I started digging deeper and found out why. While on Manila a permalink consists of an anchor on a page generated dynamically by Manila’s custom HTTP server for which the content is assembled in Frontier, WordPress uses Apache’s mod_rewrite to parse the incoming URL, figure out which content is being requested, then get that out of the database and return it in the standard template. Manila’s approach allows the blogging engine to control the whole process from start to finish, while WordPress’s has a series of dependencies: on Apache, on mod_rewrite, and, it turns out, on the file system.

So here, skipping all the tried-and-failed steps, is what I had to do to get permalinks enabled:

  1. Verify that .htaccess actually exists.
  2. Chmod — change the file permissions on the .htaccess file so that WordPress can rewrite it.
  3. With help from a posting on the WordPress support site, figure out that I need to insert some specific language in the httpd.conf file, to wit, some directives for the specific directory where WordPress lives:
    • <Directory /path/to/wordpress>
    • Options Indexes MultiViews SymLinksIfOwnerMatch
    • AllowOverride Options FileInfo
    • </Directory>
  4. And, just for kicks and giggles, update the httpd.conf to add index.html.var to the DirectoryIndex line.

And some combination of those enabled mod_rewrite to work. (This posting on the old Textpattern site provided some insight as well.)

I’ve long admired the flexible navigation that WordPress provided—the ability to have monthly archive pages as well as a calendar, for instance—and it’s apparent to me now that the use of mod_rewrite is what makes that possible. I do wonder about the scalability of that solution—would it survive a Slashdotting?—but it’s interesting, having used Manila for so long, to see how another platform handles the same issues.