Pretty URLs

Hi all. I have made a simple CMS in which all pages are saved in database. On frontend, each page is viewed using the ID given in url like "?page_id=2". What I want to know how can I make the URL pretty!

For example, if a page with ID=2 is an "about us" page. I have specified "about-us" as permalink for this page in the database.

Now how do I change http://mysite.com/?r=page&page_id=2 TO http://mysite.com/about-us ????

Thanks

Maybe this could help you?

http://www.yiiframew…1/en/topics.url

http://www.yiiframework.com/wiki/53/using-search-engine-and-user-friendly-urls/