igdxigdx 发表于 2013-02-28 13:49

nginx id 跳转问题请教

现在如下需求

跳转id 89-95;99-120
http://wap.test.com/dt.php?t=id跳转到http://wap.test.com/down/id/test_id.apk

例如
把http://wap.test.com/dt.php?t=89跳转到http://wap.test.com/down/89/test_89.apk

我用以下方式可以完成单个跳转
if ( $query_string = "t=89" ){ rewrite ^ /down/89/test_89.apk last; }

请教各位,怎么完成批量的跳转呢?

LnBSD 发表于 2013-02-28 15:53

igdxigdx 发表于 2013-02-28 13:49 static/image/common/back.gif
现在如下需求

跳转id 89-95;99-120


if ( $query_string ~* "t=(+)" ){ rewrite ^ /down/%1/test_%1.apk last; }

igdxigdx 发表于 2013-02-28 16:47

回复 2# LnBSD


    感谢,这里热心的兄弟就是多,已经搞定,附上

      if ( $query_string ~* "89|90|91|92|93|94|95" ){
                rewrite ^/dt.php /down/$arg_t/test_$arg_t.apk? permanent;
      }

lsstarboy 发表于 2013-03-01 07:51

就跳你指定的这几个?

LnBSD 发表于 2013-03-01 11:22

回复 3# igdxigdx

看来我想当然了,引用了apache的习惯,应该用 $1 才对



   

igdxigdx 发表于 2013-03-04 15:34

回复 4# lsstarboy

对,跳指定的ID


   

igdxigdx 发表于 2013-03-04 15:35

回复 5# LnBSD


    兄弟已经指出路往哪边走了:wink:
页: [1]
查看完整版本: nginx id 跳转问题请教