折雨的天空
优乐笑话网nginx重写规则,记录一下
2012-12-18 我好笨



#定义错误页面
error_page 404 /error.html;
#重写首页
rewrite ^index\.html$ index\.php last;
#将所有以前的分类页重定向到新站
rewrite ^index_list\.php$ http://$host/index\.html permanent;
#重定向原来的文章查看页
rewrite ^html/(.*)/(.*)_(.*)\.html$ http://$host/default/view/index/id-$2\.html permanent;
#重定向原来的列表页
rewrite ^html/list_(.*)_(.*)\.html$ http://$host/index\.html permanent;
#重定向搜索页
rewrite ^tag\.php$ http://$host/default/search/index/key-$1.html permanent;
#重定向原来的default
rewrite ^default/(.*)\.html$ http://$host/$1\.html permanent;
rewrite ^google5c8605518c13705c\.html$ google5c8605518c13705c.html last;
#最简洁的方式没有ac,没有其他参数,包括留言本、订阅、rss等
rewrite ^([^/]+)\.html$ index\.php?ct=default&m=$1 last;
#有ac,无参数
rewrite ^([^/]+)/([^/]+)\.html$ index\.php?ct=default&m=$1&ac=$2 last;
#有ac,有单个参数
rewrite ^([^/]+)/([^/]+)/([a-z0-9_]+)-([^/-]+)\.html$ index\.php?ct=default&m=$1&ac=$2&$3=$4 last;
#ac,有两个参数,常见与分页
rewrite ^([^/]+)/([^/]+)/([a-z0-9_]+)-([^/-]+)-([a-z0-9_]+)-([^/-]+)\.html$ index\.php?ct=default&m=$1&ac=$2&$3=$4&$5=$6 last;






只是对web。手机模块重写类似。







这个是有错的,注意"."不用转义
发表评论:
昵称

邮件地址 (选填)

个人主页 (选填)

内容