###当存在多个子目录格式的域名时,需要多写几组location标签:location /目录/
location / {
if (-f $request_filename) {
break;
}
if ($request_filename ~* "\.(js|ico|gif|jpe?g|bmp|png|css)$") {
break;
}
if (!-e $request_filename) {
rewrite . /index.php last;
}
}我电脑端用的这个ng环境伪静态代码首页,栏目页,文章页面都可以。但是手机端用通用的代码就不行了,只有首页和栏目页正常,文章页面出现404错误,我手机端是绑定的域名模式。
location /手机目录/ { if (-f $request_filename) { break; } if ($request_filename ~* "\.(js|ico|gif|jpe?g|bmp|png|css)$") { break; } if (!-e $request_filename) { rewrite . /index.php last; } } location / { if (-f $request_filename) { break; } if ($request_filename ~* "\.(js|ico|gif|jpe?g|bmp|png|css)$") { break; } if (!-e $request_filename) { rewrite . /index.php last; } }