IIS redirect preserve QueryString?
- Go into the IIS site properties for the domain you're moving from. In the "Home Directory" tab, click the option "A redirection to a URL"
- In the Redirect to box, enter the domain you wish to move to (no trailing slash), plus $S$Q - for example, http://www.YourDomain.com$S$Q
- Next, check the options that state the client will be sent to "The exact URL entered above", and "A permanent redirection for this resource"
You can see the complete solution here:
Tried it in IIS 10 and works as expected.
The status code can be anything you prefer. 301 for permanent redirect and 302/307 for temporary redirect.