简体   繁体   中英

nginx two wildcards in location rule

I have this location rule in my config file and what I'm trying to do is to get two params from the URL .

I want to accept all characters including Latin, Cyrillic etc.

The problem is that echo $_GET["video_name"]; returns both params like first_param/second_param and echo $_GET["not"]; returns undefined .

What am I doing wrong here?

location ~ ^/related/(.*)$/(.*)$ {
    try_files $uri $uri/ /api/related.php?video_name=$1&not=$2;
}

I figured out that the first $ is breaking the rule. It should be smth like this.

location ~ /related/(.*)/(.*)$ {
    try_files $uri $uri/ /api/related.php?video_name=$1&not=$2;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM