Getting WordPress, mod_rewrite and Leopard to work together
I’ve been trying to get Leopard, Apache 2 and WordPress working together for a while now. I want to use the WordPress friendly URL feature, and this requires the Apache mod_rewrite module to work too. There are various places around the web that have partial solutions to these problems. Here’s the procedure I followed - YMMV
First off, WordPress is installed in /Users/jameshiggs/Sites/blog. Leopard comes with Apache 2.2 installed, but has PHP disabled by default. To correct this, go to the console and change directory to /etc/apache2 and open httpd.conf in your favourite editor. For me this means typing:
sudo mate httpd.conf
You’ll probably have to enter your admin password. Find the line that reads:
#LoadModule php5_module libexec/apache2/libphp5.so
and uncomment it so that it looks like this:
LoadModule php5_module libexec/apache2/libphp5.so
Next, we need to make sure that your user directory allows .htaccess rules. To do this, create a file called jameshiggs.conf (obviously, you’ll need to replace my user name with yours) in /etc/apache2/users. The contents of that file should read:
<Directory "/Users/jameshiggs/Sites"> Options Indexes MultiViews AllowOverride All Order allow,deny Allow from all </Directory>
Again, you’ll need to replace my user name with yours.
The final piece of the jigsaw is to configure WordPress to use friendly URLs - which you do from the Options > Permalinks page. I’ve selected the second option which makes URLs look like this: http://localhost/~jameshiggs/blog/2007/12/25/sample-post/. If WordPress can write to the site root then it will automatically create the .htaccess file. If not, you’ll need to create it yourself in the root of your blog site. On my machine, the file should look like this:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /~jameshiggs/blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /~jameshiggs/blog/index.php [L]
</IfModule>
Finally, you need to restart Apache - the easiest way to do that is to go to System Preferences > Sharing panel and untick Web Sharing. Once Apache has stopped, tick it again and Apache should start up. And that’s it.
Let me know if you have any variants to this procedure.
Thanks to Bagelturf and Ariadoss for hints that helped me get this running.
Not loving Stacks on Leopard?
Via Matt Legend Gemmell I found Quay - a way to have Tiger-style hierarchical folder menus in your dock, in case Leopard’s Stacks aren’t doing it for you. It’s shareware and costs only €7.
Leopard glitches
I’ve been using Leopard for a while now and, broadly, I like it. But there are one or two things that are really pissing me off.
- The PubSubAgent (used for .Mac bookmark synchronisation) craps itself all the time if you’re behind a proxy
- Disk images don’t always eject properly in the Finder sidebar
- As I mentioned before, AirPort Extreme discs don’t auto-mount or show up in the Finder properly
- iCal seems to have lost the event details panel and has replaced it with an annoying speech-bubble thing
- There are still too many apps with compatibility problems (Pukka and MySQL being the two that are affecting me at the moment)
Time Machine backups to AirPort Extreme
I was disappointed when I installed Leopard to find that I couldn’t use my AirPort Extreme shared disc as the backup location - what I wanted was to be able to backup all my Macs to the same disk without needing to attach portable drives to them.
There is a solution - you can just enable backing up to shared drives as a preference, and 9 to 5 Mac have the solution here.
[Update: it turns out that this is a fairly long way from a perfect solution - Leopard doesn't seem to support auto-mounting of AirPort Extreme shared discs - so Time Machine gets confused when the OS starts up and doesn't seem to be able to recover. There's more on that disc auto-mounting issue on the Apple support site.]
