Rest Api is not working


I am new for YII2, and i want to create a rest API,

and i created a rest api based on the below guide

but after trying a lot i am getting the following error only, am not sure what i have done wrong or wht i have to do.

I have attached the main config file change image.

Thanks in advance.

An Error occurred while handling another error:

exception ‘yii\base\InvalidRouteException’ with message ‘Unable to resolve the request “site/error”.’ in D:\xampp\htdocs\yii\vendor\yiisoft\yii2\base\Module.php:462

Stack trace:

#0 D:\xampp\htdocs\yii\vendor\yiisoft\yii2\web\ErrorHandler.php(93): yii\base\Module->runAction(‘site/error’)

#1 D:\xampp\htdocs\yii\vendor\yiisoft\yii2\base\ErrorHandler.php(109): yii\web\ErrorHandler->renderException(Object(yii\web\NotFoundHttpException))

#2 [internal function]: yii\base\ErrorHandler->handleException(Object(yii\web\NotFoundHttpException))

#3 {main}

Previous exception:

exception ‘yii\web\NotFoundHttpException’ with message ‘Page not found.’ in D:\xampp\htdocs\yii\vendor\yiisoft\yii2\web\Request.php:191

Stack trace:

#0 D:\xampp\htdocs\yii\vendor\yiisoft\yii2\web\Application.php(80): yii\web\Request->resolve()

#1 D:\xampp\htdocs\yii\vendor\yiisoft\yii2\base\Application.php(375): yii\web\Application->handleRequest(Object(yii\web\Request))

#2 D:\xampp\htdocs\yii\frontend\index.php(16): yii\base\Application->run()

#3 {main}

Do you have site/error which is accessible?

I am not sure , Is this your asking,

as i am very new to this framework.

This is in my main.php

‘errorHandler’ => [

        'errorAction' => 'site/error',


	'urlManager' => [

					'enablePrettyUrl' => true,

					'enableStrictParsing' => true,

					'showScriptName' => false,

					'rules' => [

						['class' => 'yii\rest\UrlRule', 'controller' => 'user'],



Post your SiteController.