views:

30

answers:

1

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.

+2  A: 

The most common method is to redirect everything to index.php via mod_rewrite, and do all url parsing in php code. See for example http://stackoverflow.com/questions/2669258/redirect-everything-to-index-php/2669298#2669298

stereofrog
Thanks very much for that.
Delan Azabani