Wordpress permalink follow-up
So regarding my previous post on generating pretty links with wordpress. After reexamining the Apache way, and reading a bit more about how sun web server does rewriting and expressions, I finally figured out the “right” way to do it.
Behold the true form:
<If not -e"$path">
PathCheck fn="restart" uri="/index.php"
</If>
No wacky server.xml variables, no regular expressions, and no rewriting before we should.
First of all, I got rid of the expensive (?) ~= that matched everything after the first / in the uri. In this case we don’t need it, because secondly, we always just want to redirect to /index.php. Wordpress figures out the rest of the arguments from other magic variables that I don’t fully understand yet (probably PATH_INFO). Thirdly, I changed it to a PathCheck fn=restart since at the PathCheck stage it is possible to determine if $path exists as a physical file. We just restart the whole shebang with a new uri if it’s not. And for cleanliness sake, fourthly, I switched from not -f and not -d to one simple not -e which accomplishes the same thing.
Hope this helps someone besides me. I’m planning a follow up post describing some of the performance characteristics. I’ve tried fastcgi vs the nsapi plugin with php and as a preview: the plugin is hella fast, but hella leaky as well, whereas the fastcgi is rock solid but can’t scale past the number of child processes I give it. Also APC makes a HUGE difference, especially with the nsapi plugin. Too bad about those leaks…