Yii2 Rest Api Url Manager Problem

Hi,

I’m testing REST API with Yii2 and I have hit a wall.

Here is what I have done according to the Guide

  1. Created Controller

<?php

namespace app\controllers;


class ApiController extends \yii\rest\ActiveController

{

	public $modelClass = 'Category'; //my Model inheriting from AR

	

}



  1. Added to URL manager as said

'urlManager' => [ 

        	'enablePrettyUrl' => true, 

        	'showScriptName' => false,              

        	'enableStrictParsing' => true, 

        	'rules' => [ 

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

        	], 

    	],



Now Each time I try to get Rest API via http://localhost/basic/web/api/ it throws 404 not found.

As a matter of fact it have messed up my codes and even home page cannot be found.

What am I doing wrong?

Also any in depth

It happened to be problem in Apache configurations and the enableStrictParsing option.

Changed config and disabled the option and it works fine.

Any implication in rest for disabling enableStrictParsing option?

change


public $modelClass = 'Category'; //my Model inheriting from AR

to


public $modelClass = 'app\models\Category'; //my Model inheriting from AR

thanks.

I had that already and forgot to update.