简体   繁体   中英

Replace one word of domain URL in IIS

I moved my project to a new server (from abc.com/eco to abc2.com/eco) and created a HTTP redirect rule to redirect every abc.com/eco requests to abc2.com/eco. which works fine on abc.com/eco requests.

在此处输入图像描述

The problem is, Urls after eco does not get redirected.

For example : abc.com/eco/departments/main.aspx?id=123

does not redirect to

abc2.com/eco/departments/main.aspx?id=123

The following Url rewrite rule doesnt work also:

<rule name="Redirects to abc2.com" patternSyntax="ECMAScript" stopProcessing="true">

    <match url=".*" />

    <conditions logicalGrouping="MatchAny">

        <add input="{HTTP_HOST}" pattern="^abc.*(com|net)$" />

    </conditions>

    <action type="Redirect" url="http://abc2.com/{R:0}" />

</rule>

I looked over tens of questions but all are asking about the subdirectory replace.

Similar questions but not answering mine:

Question 1

Question 2

The rule is working properly on my side.

Have you cleaned cache before testing a new rewrite rule with long term permanent redirect.

If you didn't clean the browser cache, your previous HTTP redirection will keep redirecting your URL to http://abc2/eco

在此处输入图像描述

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM