Hello
I have a MVC Site which I want to redirect.
Currently it is running on a subdomain.
How can I now redirect the site to a domain?
https://subdomain.olddomain.com/MyClass/?Wicked=true
to
https://newdomain.com/MyClass/?Wicked=true
So subdomain.olddomain.com should be replaced with newdomain.com
Tried:
<system.webServer>
<rewrite>
<rules>
<rule name="redirect" stopProcessing="true">
<match url="^(.*)$" />
<action type="Redirect" url="https://newdomain.com" />
<conditions>
<add input="{HTTP_HOST}" pattern="subdomain.olddomain.com" />
</conditions>
</rule>
</rules>
</rewrite>
</system.webServer>
this is redirecting
https://subdomain.olddomain.com/MyClass/?Wicked=true
to
https://newdomain.com/?Wicked=true
instead of
https://newdomain.com/MyClass/?Wicked=true
What am I missing?
Second attempt was using HTTP Redirect:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<httpRedirect enabled="true" destination="https://newdomain.com$S$Q" exactDestination="true" httpResponseStatus="Permanent" />
</system.webServer>
</configuration>
Doesnt work either (loading forever)
Thanks