Yii2 URL 管理器规则

Yii2 URL Manager Rules

我在 yii2 中使用 URLManager 规则创建漂亮 url 时遇到问题。

我的 SiteContoller 有 actionProduct($slug),它生成 url:http://localhost/myweb/web/site/product?slug=new-product-name,我想创建 url,如:http://localhost/myweb/web/produkt/new-product-name

我尝试使用一些规则:

但它不起作用。

尝试将 <slug:[\w\-]+> 作为左侧 URL 规则的一部分。