OK so I am again revisiting SEO. After much wrangling and wrestling with mod_rewrite, htaccess files, and some mysql nonsense, I believe I have the tools at my disposal to do some good rewriting.

So now I'm wondering what the main tasks are to rewrite crappy urls into good ones. Is the point just to get the keywords in the URL or are there other things that help? For instance, is it OK to have a .PHP extension or should one try to make them all appear to be .HTML? Also, are there good techniques for hiding query string parameters?

For instance, is this ok?
Or is this better?