nginx location regex

前端 未结 1 2010
星月不相逢
星月不相逢 2021-02-13 14:19

I\'m setting up nginx and I need to use the location directive to match all requests that begin with /site1 AND end with .php. What regex do I use to d

相关标签:
1条回答
  • 2021-02-13 15:02

    You want this: ^(/site).*(\.php)$. This means that first you match the beginning followed by "/site", then anything any number of times, and finally ".php" followed by the end of the string. If you don't need the captures, it would be simpler as: ^/site.*\.php$.

    0 讨论(0)
提交回复
热议问题