Route with multiple category

Hello

I have question about router in Yii2

Please help me

I have tables category_post, category_product

I want config url friendly like

domain/category/slug-of-post

domain/category/slug-of-product

maybe in code <?=HTML::a(‘title’, [['category_post/view, [‘slug’=>‘slug-of-post’, ‘type’=>‘post’]]]; ?>

<?=HTML::a(‘title’, [['category_product/view, [‘slug’=>‘slug-of-product’, ‘type’=>‘product’]]]; ?>

In rules UrlManager, How to I config it???

When User access to url domain/category/slug-of-post point to CategoryPostController with actionView()

domain/category/slug-of-product point to CategoryProductController with actionView()

I dont want create url with format domain/category/post/slug-of-post or domain/category/product/slug-of-product

Thank you! So much