magpiebrain

Sam Newman's site, a Consultant at ThoughtWorks

Well, as per “MarkPilgrim’s instructions(Cruft-free URLs in Movable Type)”:http://diveintomark.org/archives/2003/08/15/slugs and with a little help from Dave Dribin’s “@MTEntryShortTitle@”:http://www.dribin.org/dave/software/movabletype/ plugin, my URL’s should be a little more “user friendly(Jakob Nielsen – URL as UI)”:http://www.useit.com/alertbox/990321.html, and a little more “future-proof(Movable Type’s non-permanent permalinks)”:http://mar.anomy.net/entry/2003/06/09/13.28.59/. Getting Apache to handle my files as PHP without file extensions was more work than it should of been – conventional wisdom has it that Apache’s @DefaultType@ directive should of worked:

DefaultType application/x-httpd-php


This should match any files not already assigned a MIME type and handle them as PHP. Something about my ISP’s setup didn’t allow this (I suspect something in the site-wide configuration was already assigning a MIME type for files without a suffix), so instead I had to use the @ForceType@ directive:


ForceType application/x-httpd-php

@ForceType@ overrides any MIME assignments for the files that get matched by the surrounding @FileType@. Anyway, it all seems to be working, but if anything looks bust then please “let me know(Contact Me)”:http://www.magpiebrain.com/contact. I am now including my sidebar using PHP – this means I can rebuild my sidebar once (as opposed to once per page that gets rebuilt), and it gets included on each page on request. Now that I’ve radically improved the efficiency of page rebuilding (and I suspect there are more improvements to come) I’m more able to look at some other more computationally expensive features for the blog.

4 Responses to “De-crufty PHP Movable Type goodness”

  1. David Evans

    That’s not working for me on my site. Are you doing dynamic publishing? I got rid of all files except for static index.html home page which was great, but now I’m having a heck of a time with the extentionless archives containing php being processed correctly. The php doesn’t get parsed, and it doesn’t show up as raw text either. Any ideas? Nobody seems to be addressing this particular situation, lots of cruft-less url posts but none with 3.x and dynamic publishing.

    Reply
  2. sam newman

    I’d not using MT’s dynamic publishing – I’m serving up PHP, but it’s statically generated. It was a bit of a pain to get files without the .php suffix serving as PHP, but the ForceType thing did seem to sort it. The fact that the PHP isn’t showing up as raw text is very odd.

    To be honest I’m not sure how dynamic publishing should affect this, as MT is still serving up PHP which Apache has to process, but the fact that you’re not even seeing the raw php in the rendered html does lead to the possibility that MT is playing around here. As a test, try generating a static PHP page without the PHP suffix, and see if that gets processed correctly.

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Basic HTML is allowed. Your email address will not be published.

Subscribe to this comment feed via RSS

%d bloggers like this: