转:yii隐藏Url中的index.php的方法


.htaccess的第一种写法:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\?*$ index.php/$1 [L,QSA]

.htaccess的第二种写法:

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的配置文件main.php的设置:

'urlManager'=>array(
    'urlFormat'=>'path',
    'showScriptName'=>false,
     'caseSensitive'=>false,        
),

http://www.yiiframework.com/wiki/214/url-hide-index-php/

Archives