URL rewrite

Hi, forum. This is my first post. I’m yii-newbie. Please correct me if I’m doing something wrong.

For studying purposes I’m trying to create e-commerce suite. It’s a simple application with categories and subcategories and each subcategory may have goods associated with it. Using gii I’ve created ‘category’ model and all the necessary CRUD and later customized all views. Now categories accessed via following url:

example.com/category/<category_id>. I would like it to be:

example.com/<category_name>. And for subcategories:

example.com/<category_name>/<subcategory_name>.

Then goods would be acceced via:

example.com/<category_name>/<subcategory_name>/<id>.htm or as example.com/goods/<id>.htm (don’t know which is better from SEO point of view?).

I can do all that via RewriteRules in .htacces but does yii provides better approach?

Any suggestions?

TIA