Rewrite the url address using nginx and forward it to the rewritten address

for example:
request http://xxx.com/pro/class-mode
is actually forwarded to address http://xxx.com/pro/class/model
while request http://xxx.com/pro/class is not forwarded
where pro , class , mode are all variable values, regardless of the fact that they contain - (horizontal line)
requires that the browser address bar url cannot be changed

my idea is to use rewrite and proxy_pass to match a route that meets the rules, then rewrite the route, change the middle horizontal line to a slash, and then forward the rewritten route, but it always has the effect of redirection.
Thank you very much for your answers, Crab

Oct.20,2021

rewrite will of course redirect. Just forward it.

location /(.*?)/(.*?)-(.*?)/ {
    proxy_pass http://xxx.com/$1/$2/$3/;
}

give it a try

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3d0cf-2c343.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3d0cf-2c343.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?