Nginx rewrite problem

location ~ ^ / new/ (. +) / (. +) {

proxy_pass nodejs;

}

The effect of

above is that if you visit http://localhost/new/25/9, give it to nodejs for processing. But now there is a http://localhost/news/25/9. I hope this news can be automatically converted to new,. How to configure the master rules? thank you very much.

Mar.19,2022

location ~ ^/new/(.+)/(.+) {
    proxy_pass nodejs;
}

location ~ ^/news/(.+)/(.+) {
    -sharp rewrite + permanent:  301 url 
    rewrite ^/news/(.*)$ /new/$1 permanent;
}
Menu