In Yii2, by default, this kind of URL: /foo-bar will be translated to this action:
public function actionFooBar() {
// ...
}
What if I want the same URL to contain a number, like this: /foo-bar-3 ?
I tried actionFooBar3()
and actionFooBar_3
- no luck, 404 is thrown when I access /foo-bar-3.
Ideas?
UPDATE:
So, the URL threw 404 because there was a typo in it, which I failed to see after too-many hours of work. Don't be a workaholic. Also, I upvote the 3 answers below, as all seem to be valid and might be helpful to others.