1. Nginx配置
在nginx.conf的server {段添加类似如下代码:
Nginx.conf代码:
location / { if (!-e $request_filename){ rewrite ^/(.*) /index.php last; } }
if (!-e $request_filename) { rewrite ^(.+)$ /index.php?q=$1 last; }
2. 在Yii的protected/conf/main.php去掉如下的注释
Php代码:
'urlManager'=>array( 'urlFormat'=>'path', 'rules'=>array( '/'=>'/view', '//'=>'/', '/'=>'/', ), ),