Nginxrewrite question mark handling method

Source: Internet
Author: User
Today, I configured a rewrite for nginx, which is basically killed. In fact, I just want to put/xxx/0.mp4? Key = 123456abcde to/xxx.mp4? Segno = 0 & amp; key = 123456abcde this form has been constantly tried, but also analyzed the causes, found that some of the problems that must be paid attention to in the content settings of the content: 1. in the regular expression for rewrite, nginx only adds? Match the previous part 2. match

Today, I configured a rewrite for nginx, which is basically killed. In fact, I just want to put/xxx/0.mp4? Key = 123456abcde to/xxx.mp4? Segno = 0 & key = 123456abcde this form has been constantly trying, but also analyzed the reasons, found that some problems must be paid attention to in the content settings of the content:
1. in the regular expression for rewrite, nginx only adds? Match the previous part
2. after the matching is complete ,? The following content will be automatically appended to the url (including ?), If you do not want to append the following content, add? You can.
3. if you want? Use $ query_string

Note that do not use break last in the last configuration item of rewrite during debugging. use redirect to view the converted address. The configuration items used are as follows:

rewrite ^/(.+)/(\d+)\.mp4$ /$1.mp4?segno=$2&$query_string? last;  


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.