Yii nginx 环境下的路由配置

1. Nginx配置
在nginx.conf的server {段添加类似如下代码:
Nginx.conf代码:
location / {
    if (!-e $request_filename){#必须有空格
        rewrite ^/(.*) /index.php last;
    }
}
2. 在Yii的protected/conf/main.php去掉如下的注释
Php代码:
'urlManager'=>array(
	'urlFormat'=>'path',
	'rules'=>array(
		'/'=>'/view',
		'//'=>'/',
		'/'=>'/',
	),
),
参考文章:http://laozhao000.blogbus.com/logs/218500917.html
comments powered by Disqus