PHP Pretty URLs

I’ve always wondered how to handle pretty URLs in PHP. Read the whole article, but in summary, you setup an Apache Rewrite:

sh: /usr/bin/states: No such file or directory

And setup your index.php file with the following framework:

sh: /usr/bin/states: No such file or directory

Turns out pretty URLs in PHP are super easy, and they’re great for SEO.

Update: You need to be a little more careful will 404 handling. Your 404.php page must have the following line at the top of it:

sh: /usr/bin/states: No such file or directory

If you don’t do this, then search engines who come across your “404″ page will get a status message of 200, indicating that the page loaded just find. This means that they’ll add this page to their index and also not remove any pages already in their index that no longer exist.