日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > Nginx >内容正文

Nginx

【Nginx】判断URL中是否存在某个参数Parameter

發(fā)布時(shí)間:2024/9/19 Nginx 74 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【Nginx】判断URL中是否存在某个参数Parameter 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

前言

  • nginx 1.15.11(下面的代碼在此版本測試通過)

判斷URL中是否存在某個(gè)參數(shù)Parameter

假設(shè),當(dāng)URL中存在參數(shù)method=autoGenerateIndex(區(qū)分大小寫)時(shí),輸出good job;否則,輸出I'm sure it'll work out.

location ~* ^/test {#設(shè)置content typedefault_type text/html ;# HTTP Status Code 和 內(nèi)容 if ($query_string ~ ".*(?:^|\?|&)method=autoGenerateIndex(?:(?:&.*)|$)") { return 200 "Good job!"; }return 200 "I'm sure it'll work out."; }

當(dāng)訪問如下地址時(shí),看到:Good job!
http://school-test.3jcf.com/test?method=autoGenerateIndex
http://school-test.3jcf.com/test?s=job&method=autoGenerateIndex
http://school-test.3jcf.com/test?method=autoGenerateIndex&s=job

當(dāng)訪問如下地址時(shí),看到:I'm sure it'll work out.
http://school-test.3jcf.com/test?method=
http://school-test.3jcf.com/test?method=add
http://school-test.3jcf.com/test?s=job&method=autogenerateIndex
http://school-test.3jcf.com/test?method=autoGenerateIndex is work
http://school-test.3jcf.com/test?s=job&method=autoGenerateIndex is work
http://school-test.3jcf.com/test?method=autoGenerateIndex is work&s=job

總結(jié)

以上是生活随笔為你收集整理的【Nginx】判断URL中是否存在某个参数Parameter的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。