Nginx - 动态匹配路由中的ID并跳转到静态页面
# 已省略其他配置,只保留匹配步骤
# 访问 https://www.xxx.com/test/1/ https://www.xxx.com/test/2/ ... 时,会跳转 /www/demo/templates/index.html 目录下的静态页面
server { location ~ ^/test/(\d+)/ { rewrite ^/test/(\d+)/$ /test/index.html last; } location = /test/index.html { alias /www/demo/templates/index.html; } }