How to write redirection in the secondary directory under nginx?

there are several URLwww.example.com/abc/1.html
www.example.com/bdc/3.html
www.example.com/utf/2.html
in this form. You want to redirect to the corresponding
test.example.com/abc/1.html
test.example.com/bdc/3.html
test.example.com/utf/2.html

. Directories such as

abc,bdc,utf are known to have a fixed number.

how should I write the rewrite of nginx directly without root mapping?
this is my way of writing:

location ^~/(abc|bdc|utf)/(*.html) {

   rewrite ^~/*/(*.html)  https://test.example.com/$!  permanent;

}

is it wrong ~

Mar.07,2021

location ^~/(abc|bdc|utf)/(*.html) {

   rewrite ^~/*/(*.html)  https://test.example.com/$request_uri  permanent;

}

try this:

location ^~/(abc|bdc|utf)/(*.html) {

   rewrite ^(.*) https://test.example.com/$1  permanent;

}
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-1b38681-2c104.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-1b38681-2c104.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?