This is mostly for my own benefit but if you need to have a PHP script create a permanent (301) redirect, here’s how to do it:
header($_SERVER['SERVER_PROTOCOL'] . " 301 Moved Permanently");
I had some pages on Smaller World whose URLs changed some time ago that I’d forgotten to put redirects in for. Since I’m useless at regular expressions (despite owning O’Reilly’s Regular Expressions Pocket Reference book) I instead butchered the code for Movable Type’s dynamic publishing and added some redirect code for the pages in question. Since the URLs have now changed permanently I wanted to send the correct status code and this seems to be the way to do it.