简体   繁体   中英

lookahead regex in nginx location

I'm trying to match /category/anything , except /category/paid in nginx location.

I have the following regex, but it's not working. Google tells me that I can use lookahead in nginx. Am I doing something wrong?

location ^/category(?!/paid)/ {

}

You either need a slash before it or an escaped slash.

location ~ (category/(?!paid)) { .. }
location ~ (category\/(?!paid)) { .. }

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