liwe2013

nginx的伪静态规则是?

location / { 

if(-f $request_filename/index.php) {

rewrite (.*) $1/index.php break;

}

if(!-f $request_filename) {

rewrite /(.*) /index.php?rewrite=$1 break;

}


官方给的这个,经测试,伪静态后404错误

#1楼
发帖时间:2014-2-27   |   查看数:0   |   回复数:3
strdemo
我也是同样的问题,开启了,出现404或直接下载文件
2014-2-27 #2楼
bjwindy
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
rewrite /(.*) /index.php?rewrite=$1 last;
}
2014-3-2 #3楼
liwe2013
引用 bjwindy:

if (-f $request_filename/index.html){ rewrite (.*) $1/index.html break; } if (-f $request_filename/index.php){ rewrite (.*) $1/index.php; } if (!-f $request_filename){ rewrite /(.*) /index.php?rewrite


解决了,谢谢
2014-3-3 #4楼
游客组