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',
   ]
],

1 comment:


  1. Wonderful blog & good post.Its really helpful for me, awaiting for more new post. Keep Blogging!
    Offshore Yii Framework Development in India

    ReplyDelete

Recent Update

yii2 session handling

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

Most Search