Because the default action in Yii2 is index
, Yii2 redirects http://example.com/sample
to SampleController->actionIndex()
.
Now when I generate the canonical it generates http://example.com/sample/index
as the canonical. What I want is http://example.com/sample
, so without the /index
because that is already obvious and I don't want any visitors (or bots) to see that it's actually going to /index
.
I tried to add this rule '<controller>/<action:index>' => '<controller>'
to the rules
section of the urlManager
(frontend/config/main.php).
Also found this for Yii1.1. But it should be easier with Yii2 right?
Any help is appreciated! Thank you and have a great day. Melle Dijkstra