How to Handle Dynamic URLs

I've noticed that a lot of CMSes that try to use a query string and rewrite it in an .htaccess. For example: or and translate it into via .htaccess. Then they just use the $_GET superglobal to access the information they need.

I see a couple problems with this. First, it doesn't degrade very nicely ( isn't a super pretty URL), and it prevents you from using your own query string in a normal way. For example, if you tried using it would be seen as, which would mess up accessing the variables in $_GET.

You could just use the URL, but that looks even more awkward and can cause confusion with people that know a little about URLs and other developers, etc.

I've seen many other CMSes handle it better, and so I thought I'd investigate to see what I could find. I couldn't find much, but I thought I'd just experiment.

What I found out, is that it seems that when Apache reaches the index.php part of a URL, it seems to ignore everything after that. This provides an interesting opportunity. For example you can use a URL such as, and the code still goes through index.php, and you can use REQUEST_URI in $_SERVER (remember to strip out the index.php part in case your client can't use mod_rewrite).

Interestedly enough, it does seem to stop processing the URL as soon as it sees index.php. You could go to and it would still process call index.php. But by using this method, it has a relatively prettier fallback (just has an extra index.php in it (which if they have mod_rewrite, isn't an issue)), and you can use query strings like normal.

I am sure this is indeed documented and I just didn't know what to search for, but these were just my findings.