Error In Yii2.0 Url Manager - Page Not Found

I want Url like this:


So I changed rules in UrlManager

'admin/login' => 'backend/web/site/login',

It shows page not found!

I don’t know where it goes wrong!

  1. You should enable clean urls (see manual on how to do this)

  2. ‘backend/web’ is application folder. You shouldn’t include it in the route. Leave just ‘site/login’. Where site is SiteController, and login is actionLogin() method of this controller.

P.S. You can use something like ‘admin/site/login’ as a route, if it’s module’s route, i.e. controller resides in a module.

Let us know if it works.

'admin/site/index' => 'backend/web/site/index'

is not working!!! :blink:

Any other suggestion pls!!! :unsure:

Man, would you read carefully prior to trying and posting?

I suggested this:

‘admin/login’ => ‘site/login’,

But this might not work either. I suggest you read manual on urls .


Yii is rather complicated to use without understanding it. If you want something that works right out of the box, try some microframework instead, like flight php ( I use this like "micro Yii" for minor projects.

Good luck.