location / {
rewrite "^([^.]*)/([a-zA-Z0-9\_-]+)/home(.*)$" /index.php/$1/home$2 last;
rewrite "^([^.]*)/gbook$" /index.php/gbook last;
rewrite "^([^.]*)/page(.*)$" /index.php/page$1 last;
rewrite "^([^.]*)/opt(.*)$" /index.php/opt$1 last;
rewrite "^([^.]*)/user(.*)$" /index.php/user$1 last;
rewrite "^([^.]*)/api/(.*)$" /index.php/api/$1 last;
#图片重定向
rewrite "^([^.]*)/picdata(.*)$" /index.php/picdata$1 last;
# 视频伪静态
rewrite "^([^.]*)/vod(.*)$" /index.php/vod$1 last;
# 歌曲伪静态
rewrite "^([^.]*)/dance(.*)$" /index.php/dance$1 last;
# 歌手伪静态
rewrite "^([^.]*)/singer(.*)$" /index.php/singer$1 last;
# 视频伪静态
rewrite "^([^.]*)/vod(.*)$" /index.php/vod$1 last;
# 文章伪静态
rewrite "^([^.]*)/news(.*)$" /index.php/news$1 last;
# 专集伪静态
rewrite "^([^.]*)/topic/(.*)$" /index.php/zj/$1 last;
rewrite "^([^.]*)/zj/(.*)$" /index.php/zj/$1 last;
break;
}
开发兔kaifatu.com提醒您 如果遇到后台404可以试试如下Nginx伪静态规则
if (!-f $request_filename){
set $rule_0 1$rule_0;
}
if (!-d $request_filename){
set $rule_0 2$rule_0;
}
if ($rule_0 = "21"){
rewrite ^/(.*)$ /index.php?/$1 last;
}