Running Panther Server: Using the mod_rewrite Apache module

Posted by Pierre Igot in: Macintosh
May 26th, 2004 • 6:31 am

This is a follow-up to my report on setting up a blogging system on my Xserve running Panther Server (Mac OS X Server 10.3.3).

Yesterday I wrote that I had managed to get most things to run fine on the Xserve, including PHP, MySQL, and the open source WordPress blogging system. The only thing that I couldn’t get to work properly was the feature in WordPress that enables the use of user-friendly URLs for links to specific items within the blog.

With the help of the good folks that contribute to the Apple Discussions forum on Panther Server usage and to the WordPress support forums, I was able to sort things out fairly easily after all.

It turns out that, as is often the case, my problem was basically a lack of understanding of the underlying mechanisms that govern things in Panther Server and in the Apache-based web service in particular. It was also due to the fact that the recommendations in the WordPress documentation are mostly intended for people who install WordPress on someone else’s server and don’t have admin access to the server’s configuration. In that case, the only way to implement the user-friendly URLs is to upload a customized .htaccess file to your root folder on the server. But for this to work, this .htaccess file needs to be able to override the server-wide settings established by the server administrator.

It just so happens that the ability to use .htaccess files that override the server-wide settings is off by default in Panther Server’s Apache configuration. I tried to change that in the main httpd.conf file that contains all the Apache configuration settings, but that didn’t work. I then discovered that there was not only a general httpd.conf file for the server, but also a .conf file for each web site hosted by Panther Server. (Each user in Panther Server can have his own web site.) And it seems that the default web site has its own .conf file too. So even if you are the only user with a web site, you still have to manage two files, both of which have a setting that allows .htaccess files to override their other settings.

If you are getting a bit confused, well, so was I. At that stage, I figured that it would probably be faster for me not to try to use the .htaccess file to override the settings, and to simply include the rewrite rules that WordPress needed for the user-friendly URLs in the .conf file instead. I did just that… and it still wasn’t working. Since the 404 error page was loading so fast on my pokey modem connection, I started suspecting cache issues. And once I did a force-reload of the web site in Safari (holding the Option key down while clicking on the Reload button), finally, it started to work.

I would say that the lesson here is that 1) the documentation for open source products is not always user-friendly, especially when the “user” in question happens to be a Mac-using server administrator; 2) in spite of Apple’s efforts on the graphic UI front in Panther Server, there are still many things that simply cannot be done through the UI and that require that you go and get your hands dirty by editing configuration files manually.

None of this is surprising. But when you experience it first-hand, it still is a challenge, no matter how prepared you are. I don’t think anyone really has time to read through the entire documentation for tools such as MySQL or Apache. (We are talking about hundreds, if not thousands of pages here.) You just read what you need — but it’s a bit of a catch-22 because you need to start reading in order to determine what you need to read.

Oh well. Live and learn, as they say.


7 Responses to “Running Panther Server: Using the mod_rewrite Apache module”

  1. Stuart says:

    Thanks Pierre. I missed that section of the admin area the first time around, now I see it.

    -Stuart

  2. Pierre Igot says:

    Stuart: the rewrite rules that WordPress required are generated on the fly by WordPress based on your own personal configuration. So I cannot quote the rules here (they’d only apply to my config). You’ll find the rules under Options>Permalinks in the WP admin pages. I just copied them from there.

  3. Stuart says:

    Hi Pierre, very clear and easy to follow writing. One question though. You wrote, “…simply include the rewrite rules that WordPress needed…” but yo udon’t mention what those rules are. Could you point me in the right direction (I have the same problem as you… mod_rewrite is on but I still can’t use search engine friendly URLs)

  4. Pierre Igot says:

    If you are hosting several sites in the

    Library/WebServer/Documents

    folder, each site has its own .conf file inside

    etc/httpd/sites/

    . I believe you have to allow

    .htaccess

    files to override the

    .conf

     settings for each site, i.e. in each site-specific

    .conf

    file in addition to the main

    .conf

    file.

    Please note that I haven’t actually done this myself. :)

  5. Galen says:

    Hi there,

    Nice article?I got quite excited for a moment thinking I had finally found the answer to my problem.

    Unfortunately you stopped just short. What I would like to know is how I can use .htaccess files with more than one website. I am developing many websites on my local machine (running OS X 10.3 Server) and have them all in the Documents folder inside the WebServer folder in Library.

    With some of the sites I would like to be able to use ‘friendly URLs’ using .htaccess file. For these sites I have added a new site in the Server Admin settings and have added the appropriate info to NetInfo Manager as well.

    What I now can’t figure out is how to modify the .conf file for each site as opposed to for the whole server. I did a search on local disks in the Finder for .conf files and there seems to be only one. Where are the .conf files located for each site?

    Your (or anybody else’s) help would be greatly appreciated.

    Thanks heaps,
    Galen

    Lucid Design

  6. Galen says:

    Pierre,

    Awesome, thanks so much! Works perfectly now. Finally, after almost a year of trying to make this work, I can finally have ‘friendly’ URLs in my dynamic sites.

    Cheers,
    Galen

  7. Pierre Igot says:

    Cool. Glad I could help :).

Leave a Reply

Comments are closed.