Route with multiple category


I have question about router in Yii2

Please help me

I have tables category_post, category_product

I want config url friendly like



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