Yii URL隐藏index.php

一。修改config/下的main.php里的

'urlManager'=>array(
            'urlFormat'=>'path',
            'showScriptName'=>false,             'rules'=>array(
            '<controller:\w+>/<id:\d+>'=>'<controller>/view',
            '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
            '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
            ),
          ),

二。修改网站根目录下.htaccess文件内容如下
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on

# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# otherwise forward it to index.php
RewriteRule . index.php


你可能感兴趣的:(Yii URL隐藏index.php)