Redirection from one domain to another domain

Can we have the following redirection in hugo setup
a.com/?test=test to
b.com/new/?test=test

can we write in htaccess?

htaccess is specific to the Apache web server. If you are asking about if Hugo can write to an htaccess file, the answer is yes, as a custom output format. If you have a question about other stuff (not Hugo), please search elsewhere.

https://discourse.gohugo.io/search?q=htaccess