1.apache開啟 rewrite 模組:
sudo a2enmod rewrite
/etc/apache2/sites-enabled/000-default:
...
AllowOverride All
...
3.yii webapp目錄下加個檔案.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
4.修改yii webapp的設定檔:
$YII_WebRoot/protected/config/main.php
'components'=>array(
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName'=>false, //隱藏index.php
'caseSensitive'=>false, //不管大小寫
...
完成~
0 意見:
張貼留言