Yii URL隐藏index.php

来源:互联网 发布:令狐冲 知乎 编辑:程序博客网 时间:2024/04/30 15:36


一。修改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 +FollowSymLinksIndexIgnore */*RewriteEngine on # if a directory or a file exists, use it directlyRewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-d # otherwise forward it to index.phpRewriteRule . index.php


0 0