#http://www.tianyun.com/qf/11-22-33/1.html ==> http://www.tianyun.com/qf/11/22/33/1.html #http://ip/2019-10-23/hello.html ==> http://ip/2019/10/23/hello.html # /qf/11-22 location ~ qf/[0-9]+- { rewrite /qf/([0-9]+)-([0-9]+)-([0-9]+)/(.*)$ /qf/$1/$2/$3/$4 permanent; } # /qf/11/22 location ~ ^/qf/[0-9]+/.*$ { root /usr/share/nginx/html; }