Showing posts with label remove web from url yii2. Show all posts
Showing posts with label remove web from url yii2. Show all posts

Thursday, April 12, 2018

How to remove index.php in Yii Framework

Yii Url Routing

In this example user can remove index.php from the URL. You need to set showScriptName false and enablePrettyUrl should be true.

In below example /user/profile will be replaced with /profile.

You need to change file config/main.php

'urlManager' => [
   'showScriptName' => false,
   'enablePrettyUrl' => true,
   'rules' => [
      'profile' => 'user/profile',
   ]
],

Recent Update

yii2 session handling

use yii\web\Session; $session = Yii::$app->session; // start session $session->open(); // close session $session->close(); ...

Most Search