Hi, I’m an old user of YII 1.1, with excelent results.
Now I’m trying 2.0, and I want to create a RESTFull api with Yii 2.0.
I downloaded and installed yii2, the I create a model and a controller with two of my tables.
But I’m facing a real problem,
When I activate urlManager and set ‘enablePrettyUrl’ => true,
i can’t acced site/index and i can’t access my controllers.
because urlManager is global… I can’t have the web app running with the standar URL format and some routes to be accesed with some rules for the REST apis ?
and do not forget to edit .htaccess file if you’re using apache as your web server.
RewriteEngine on
# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php
namespace app\controllers;
use yii\rest\ActiveController;
class Cliente_apiController extends ActiveController
{
public $modelClass = 'app\models\Cliente';
}