How to remove index.php in Yii Framework

后端 未结 9 1718
一个人的身影
一个人的身影 2020-12-08 22:56

\"enterHey guyz i am a newbie in Yii framework. I want to remove the index.php from my urls. F

9条回答
  •  Happy的楠姐
    2020-12-08 23:26

    Do these 3 steps:

    1. Enable Url re-writing on Apache.

    2. Place .htaccess on root of your project

    RewriteEngine on

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    
    RewriteRule . index.php
    
    1. In your configuration protected/config/main.php set showScriptName to false like this to your url manager components >> urlManager
    'urlManager'=>array(
      'urlFormat'=>'path',
      'rules'=>array(
          '/'=>'/view',
          '//'=>'/',
          '/'=>'/',
      ),
      'showScriptName'=>false,
    )
    

提交回复
热议问题