«
nginx伪静态demo

时间:2022-5-17    作者:程序猿    分类:


autoindex off;

location ~ .*\.(jpeg|gif|jpg)$
{
if (!-e $request_filename){
        rewrite ^/ditu/(.*)$ /dituimg.php;
        }
}
location /mip {
     if (!-e $request_filename){
        rewrite ^/mip(.*)$ /404nwes.php;
        }
    }
location /faq {
     if (!-e $request_filename){
        rewrite ^/mip(.*)$ /404nwes.php;
        }
    }    
error_page 404 /404.html;

location /lvyoutianqi {
  rewrite ^/lvyoutianqi(|\/)$ /index.php?a=category&tpl=jingdian;
}

location /tianqichaxun {
  rewrite ^/tianqichaxun(|\/)$ /index.php?a=weather;
}

location /lishitianqi {
  rewrite ^/lishitianqi(|\/)$ /index.php?c=history;
}

location /kongqizhiliang {
  rewrite ^/kongqizhiliang(|\/)$ /index.php?c=history&a=air;
}

location /tianqixinxi {
  rewrite ^/tianqixinxi/(\d+)(|\/)$ /index.php?c=news&a=show&id=$1;
}

location /qiwen {
  rewrite ^/qiwen\.html$ /index.php?a=qiwen_frame;
}

location /jichangtianqi {
  rewrite ^/jichangtianqi(|\/)$ /index.php?a=category&tpl=airport;
}

location /shijietianqi {
  rewrite ^/shijietianqi(|\/)$ /index.php?c=nation;
  rewrite ^/shijietianqi/([yaoufeibnm]+)zhou(|\/)$ /index.php?c=nation&a=continents&alias=$1;
  rewrite ^/shijietianqi/([a-zA-Z]+)wendu(|\/)$ /index.php?c=nation&a=city_temperatrue&alias=$1;
  rewrite ^/shijietianqi/([a-zA-Z]+)(|\/)$ /index.php?c=nation&a=city&alias=$1;
}

location /yujing {
  rewrite ^/yujing(|\/)$ /index.php?a=category&tpl=yujing;
}

location /pm25 {
  rewrite ^/pm25(|\/)$ /index.php?a=category&tpl=pm25;
}

location /yujing_ {
  rewrite ^/yujing_(\d+)(|\/)$ /index.php?a=category&tpl=yujing&page=$1;
}

location /town {
  rewrite ^/town/(\d+)(|\/)$ /index.php?a=town&id=$1;
}

location /meitu {
  rewrite ^/meitu/(\d+)\.html$ /index.php?c=news&a=picture_show&id=$1;
  rewrite ^/meitu/(\d+)_(\d+)\.html$ /index.php?c=news&a=picture_show&id=$1&page=$2;
}

location /ditu {
  rewrite ^/ditu(|\/)$ /index.php?c=map;
  rewrite ^/ditu/huochezhan(\d+)(|\/)$ /index.php?c=map&a=huochezhan&id=$1;
  rewrite ^/ditu/(\d+)(|\/)$ /index.php?c=map&a=show&id=$1;
  rewrite ^/ditu/([a-z]+)(|\/)$ /index.php?c=map&a=area&alias=$1;
  rewrite ^/ditu/([a-z]+)_(\d+)(|\/)$ /index.php?c=map&a=area&alias=$1&page=$2;
}

location /shijieditu {
  rewrite ^/shijieditu(|\/)$ /index.php?c=map&template=shijieditu;
  rewrite ^/shijieditu/(\d+)(|\/)$ /index.php?c=map&a=nation_show&id=$1;
  rewrite ^/shijieditu/([a-z]+)(|\/)$ /index.php?c=map&a=nation&pinyin=$1;
}

location /dianziditu {
  rewrite ^/dianziditu(|\/)$ /index.php?c=map&template=dianziditu;
  rewrite ^/dianziditu/([a-z]+)(|\/)$ /index.php?c=map&a=dianziditu&alias=$1;
  rewrite ^/dianziditu/zhen(\d+)(|\/)$ /index.php?c=map&a=town&id=$1;
}

location /jiaotongditu {
  rewrite ^/jiaotongditu/([a-z]+)(|\/)$ /index.php?c=map&a=area_type&alias=$1&typeid=1;
  rewrite ^/jiaotongditu/([a-z]+)_(\d+)(|\/)$ /index.php?c=map&a=area_type&alias=$1&typeid=1&page=$2;
}

location /lvyouditu {
  rewrite ^/lvyouditu/([a-z]+)(|\/)$ /index.php?c=map&a=area_type&alias=$1&typeid=2;
  rewrite ^/lvyouditu/([a-z]+)_(\d+)(|\/)$ /index.php?c=map&a=area_type&alias=$1&typeid=2&page=$2;
}

location /zhengquditu {
  rewrite ^/zhengquditu/([a-z]+)(|\/)$ /index.php?c=map&a=area_type&alias=$1&typeid=3;
  rewrite ^/zhengquditu/([a-z]+)_(\d+)(|\/)$ /index.php?c=map&a=area_type&alias=$1&typeid=3&page=$2;
}

location /quhao {
  rewrite ^/quhao(|\/)$ /index.php?c=quhao;
  rewrite ^/quhao/([a-z]+)(|\/)$ /index.php?c=quhao&a=area&alias=$1;
}

location /guojiquhao {
  rewrite ^/guojiquhao(|\/)$ /index.php?c=quhao&template=guoji;
  rewrite ^/guojiquhao/([a-z]+)(|\/)$ /index.php?c=quhao&a=nation&pinyin=$1;
}

location /bztz {
  rewrite ^/bztz(|\/)$ /index.php?c=quhao&a=bztz;
  rewrite ^/bztz/sanwei(|\/)$ /index.php?c=quhao&a=sanwei;
  rewrite ^/bztz/nansheng(\d+)cm\.html$ /index.php?c=quhao&a=bztz&sex=2&shengao=$1;
  rewrite ^/bztz/nvsheng(\d+)cm\.html$ /index.php?c=quhao&a=bztz&sex=1&shengao=$1;
  rewrite ^/bztz/sanwei(\d+)cm\.html$ /index.php?c=quhao&a=sanwei&shengao=$1;
  rewrite ^/bztz/(\d+)cm(\d+)kg\.html$ /index.php?c=quhao&a=bztz&shengao=$1&tizhong=$2;
  rewrite ^/bztz/(\d+)cm\.html$ /index.php?c=quhao&a=bztz&shengao=$1;
}

location /weizhang {
  rewrite ^/weizhang/([a-z]+)gaosu(|\/)$ /index.php?c=quhao&a=weizhang_area&pinyin=$1&type=gaosu;
  rewrite ^/weizhang/([a-z]+)(|\/)$ /index.php?c=quhao&a=weizhang_area&pinyin=$1;
  rewrite ^/weizhang(|\/)$ /index.php?c=quhao&template=weizhang;
}

location /sfz {
  rewrite ^/sfz/([a-z]+)(|\/)$ /index.php?c=quhao&a=sfz_area&pinyin=$1;
   rewrite "^/sfz/([0-9]{4,6})(|\/)$" /index.php?c=quhao&a=sfz_code&code=$1;
  rewrite ^/sfz/(\d+)\.html$ /index.php?c=quhao&a=sfz_show&id=$1;
  rewrite ^/sfz(|\/)$ /index.php?c=quhao&template=sfz;

}

location / {
  rewrite ^/([a-z]+)/10\.html(|\/)$ /index.php?a=weather&alias=$1&typeid=10;
  rewrite ^/([a-z]+)/30\.html(|\/)$ /index.php?a=weather&alias=$1&typeid=30;
  rewrite ^/([a-z]+)/pm25\.html(|\/)$ /index.php?a=pm25&alias=$1;
  rewrite "^/([0-9]{8,8})\.html$" /index.php?c=nation&a=weather_day&id=$1;
  rewrite ^/([a-z]+)jichangditu(|\/)$ /index.php?a=airport&pinyin=$1&type=map;
  rewrite ^/([a-z]+)jichang(|\/)$ /index.php?a=airport&pinyin=$1;
  rewrite ^/([a-z]+)15tian(|\/)$ /index.php?a=weather&alias=$1&typeid=15;
  rewrite ^/([a-z]+)kongqizhiliang(|\/)$ /index.php?c=history&a=air_city&alias=$1;
  rewrite "^/([a-z]{2,4})jiantianqiyubao(|\/)$" /index.php?c=history&a=shipin&alias=$1;
  rewrite ^/([a-z]+)lishitianqi(|\/)$ /index.php?c=history&a=city&alias=$1;
  rewrite "^/([0-9]{2,2})xiaoshitianqi(|\/)$" /index.php?c=history&a=jiangshui&hour=$1;
  rewrite ^/([a-z]+)tianqiwen(|\/)$ /index.php?c=history&a=qiwen&hour=$1;
  rewrite ^/([a-z]+)(\d+)yujing(|\/)$ /index.php?c=news&a=yujing&alias=$1&typeid=$2;
  rewrite ^/([a-z]+)(\d+)yuetianqi(|\/)$ /index.php?c=history&a=city_list&alias=$1&month=$2;
  rewrite "^/([0-9]{4,4})([a-z]+)(\d+)yuetianqi(|\/)$" /index.php?c=history&a=city_list&year=$1&alias=$2&month=$3;
  rewrite "^/([0-9]{4,4})([a-z]+)(\d+)yuekongqizhiliang(|\/)$" /index.php?c=history&a=air_city&year=$1&alias=$2&month=$3;
  rewrite ^/([a-zA-Z0-9]+)jianjie(|\/)$ /index.php?a=jingdian_show&pinyin=$1;
  rewrite ^/([a-z]+)lvyoutianqi(|\/)$ /index.php?a=jingdian_list&pinyin=$1;
  rewrite ^/([a-zA-Z0-9]+)tianqi(|\/)$ /index.php?a=jingdian_tianqi&pinyin=$1;
  rewrite "^/([0-9]{4,4})([a-z]+)(|\/)$" /index.php?c=nation&a=weather_city_day&day_num=$1&alias=$2;
  rewrite ^/([a-z]+)(|\/)$ /index.php?a=weather&alias=$1;
  rewrite ^/([a-z]+)-([a-z]+)(|\/)$ /index.php?a=weather_county&calias=$1&alias=$2;
  rewrite ^/([a-z]+)_([a-z]+)(|\/)$ /index.php?c=nation&a=weather_jieri&alias=$1&jieri=$2;
  rewrite ^/([a-z]+)/qiwen(|\/)$ /index.php?a=qiweng&alias=$1;
  rewrite ^/([a-z]+)/qiweng(|\/)$ /$1/qiwen/ redirect;
  rewrite ^/([a-z]+)/chuanyizhishu(|\/)$ /index.php?a=zhishu&alias=$1;
}

location /guotumianji {
  rewrite ^/guotumianji/([a-z]+)(|\/)$ /index.php?c=quhao&a=nation_area&pinyin=$1;
  rewrite ^/guotumianji(|\/)$ /index.php?c=quhao&template=mianji;
}

location /wangsuceshi {
  rewrite ^/wangsuceshi(|\/)$ /index.php?c=quhao&template=wangsu;
  rewrite ^/wangsuceshi/([a-z]+)dianxin(|\/)$ /index.php?c=quhao&a=wangsu_area&alias=$1&pinyin=dianxin;
  rewrite ^/wangsuceshi/([a-z]+)wangtong(|\/)$ /index.php?c=quhao&a=wangsu_area&alias=$1&pinyin=wangtong;
  rewrite ^/wangsuceshi/([a-z]+)tietong(|\/)$ /index.php?c=quhao&a=wangsu_area&alias=$1&pinyin=tietong;
  rewrite ^/wangsuceshi/([a-z]+)guangdian(|\/)$ /index.php?c=quhao&a=wangsu_area&alias=$1&pinyin=guangdian;
  rewrite ^/wangsuceshi/([a-z]+)changkuan(|\/)$ /index.php?c=quhao&a=wangsu_area&alias=$1&pinyin=changkuan;
  rewrite ^/wangsuceshi/([a-z]+)(|\/)$ /index.php?c=quhao&a=wangsu_type&pinyin=$1;
}

location /shipin {
  rewrite ^/shipin/(\d+)\.html$ /index.php?c=video&a=show&id=$1;
  rewrite ^/shipin/([a-z]+)(|\/)$ /index.php?c=video&a=lists&pinyin=$1;
}

location /weixingyuntu {
  rewrite ^/weixingyuntu(|\/)$ /index.php?c=history&a=weixingyuntu;
}

location /china {
  rewrite ^/china\.xml$ /index.php?c=xmlapi;
}
location /t/xml_city {
  rewrite ^/t/xml_city/([a-zA-Z]+)\.xml$ /index.php?c=xmlapi&a=city&alias=$1;
}

location /news {
  rewrite ^/news/(\d+)/(\d+)(|\/)$ /news/index.php?catid=$1&page=$2;
}
location /newsinfo {
  rewrite ^/newsinfo/(\d+).html$ /news/info.php?id=$1;
}