This article is a mirror article of machine translation, please click here to jump to the original article.

View: 10425|Reply: 2

[Web] nginx pseudo-static rules

[Copy link]
Posted on 7/18/2019 9:20:17 AM | | |
Wanthttp://itsvse.com/index.php?t=3rewritten with pseudo-static ruleshttp://itsvse.com/t3.html, you can add it in conf/nginx.conf in nginx.

      Add in location / {}, e.g.

        location / {
            root   D:/phpweb/wwwroot;
            index  index.php index.html index.htm;
            rewrite ^(.*)/t(\d+)\.html$ $1/index.php?t=3 last;
        }

Look closely at rewrite ^(.*)/t(\d+)\.html$ $1/index.php?t=3 last; In fact, I feel that nginx's pseudo-static rules are quite easy to write. It is to use a rewrite to declare on the basis of the regular, and then ^ is the beginning of the pseudo-static rule, (.*) matches any character, here the match is the domain name, t is the character you want to add here, for example, you can add a classification name such as apple and orange, (\d+) matches the number, \.html matches the suffix, $ is the end of the regular match. The second half is the URL to be rewritten, starting with $1 to indicate the domain name, /index.php?t=3 is the URL to be rewritten, use last; That's it.





Previous:Gain an in-depth understanding of Java virtual machines
Next:Big Data Structure
 Landlord| Posted on 7/18/2019 9:20:32 AM |
 Landlord| Posted on 1/15/2023 5:40:33 PM |
IIS URL Rewrite Module Rule Clearing
https://www.itsvse.com/thread-10410-1-1.html
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com