I am writing a CMS engine that improves upon the blog engine on my website. So far, the existing blog only has one smart URI handler - one that converts /123 into /blog.php?p=123 and that's currently done by a few mod_rewrite statments. I am afraid that this method is unwieldy and kludgy for when I have more "smart URIs" in my CMS.
At the moment, I've thought about a way that could do this in PHP, but it also seems semantically "evil". I'd get the ErrorDocument 404 to use a PHP script that parses URIs and includes proper scripts dynamically (changing the statuscode to 200 on the way).
Should I do that? Are there better ways? I'm aiming for a neat smart URI parsing just like on Launchpad.net.