I have a domain1 which is now sharing IP address with an other domain2. I have a rewrite config where I can list the rewrites individually however there are 90 urls for domain1. I would like to do this in a more efficient way by creating a wildcard. Is the syntax below correct to say redirect domain including all pages?
For example:
<add key="http://domain1.com/*" value="https://domain2.com/"/>
Or would it be better done in IIS?
<rule name="redirect domain sharing IP address" stopProcessing="true">
<match url=".*" ignoreCase="true" />
<conditions>
<add input="{HTTP_HOST}" pattern="^(www.)?domain1.com" />
</conditions>
<action type="Redirect" url="domain2.com/test" redirectType="Permanent" />
</rule>
Why get tricky or obscure? A simple
string myUrl = "http://www.domain1.com/whatever/...";
const string newDomain = "www.domain2.com";
const string oldDomain = "www.domain1.com";
myUrl = myUrl.Replace(oldDomain,newDomain);
Should do the trick to "translate" the incoming url
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.