Categories
Applications Notes

WordPress and permalinks and Mac OS X

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.

(Via Jarrett House North.)

8 replies on “WordPress and permalinks and Mac OS X”

Thanks for this – it was really handy and took me a long way towards getting the permalinks working. I got into a loop with the .htaccess file though, until I created an empty one with the right permissions, then WordPress was happy. Pasting what it gave me into a new .htaccess file didn’t work, although WordPress implied that it would.

I’ve tried the above and other proposed solutions, but I still can’t get permalinks to work correctly. Any help would be greatly appreciated.

Anyone that comes to this page but still doesn’t manage to get it work.. try this:

Options Indexes MultiViews SymLinksIfOwnerMatch
AllowOverride All Options FileInfo

There’s an ‘all’ missing in the above code that breaks it!! Now works perfectly on Mac 10.4.8!!

Thank God I found this page! I was about to give up after 5 hours!

Sorted everything out for me, didn’t need to add point 4, still worked.

Cheers

i have similar problem. but i’m not sure what is “/path/to/wordpress”. i’m quite new to mac. so i put the wordpress under the folder user > Sites > wordpress. so it should be: /user/Sites/wordpress ?

thanks a lot.

I’ve tried this all of these different ways. I can get WP to update my .htaccess file, but once it does, my site won’t load at all. I have to delete the entire .htaccess file to get the site to load again. Any ideas?