I am writing the redirect rule for redirecting the old domain url http://old.domain.com/promotions#all-views to http://new.domain.com/en-us/promotions/all
I have tried multiple options but could achieve the above redirection, here mentioned the sample rule used for this,
<rule name="Redirection for promotions" stopProcessing="true">
<match url="^promotions$" />
<conditions>
<!-- <add input="{QUERY_STRING}" pattern="all-views" /> -->
<!-- <add input="{REQUEST_URI}" pattern="#all-views$" /> -->
</conditions>
<action type="Redirect" url="http://new.domain.com/en-us/promotions/all" appendQueryString="false" />
</rule>
Issue 1: Couldn't match the url pattern "#all-views", server variables are not providing this data, I have validated with HTTP_URL, REQUEST_URI, URI, QUERY_STRING
Issue 2: "#all-views" always appended with the redirected url like, http://new.domain.com/en-us/promotions/all#all-views , how to remove the #all-views?
You can try the rule below:
<rule name="test1" enabled="false" stopProcessing="true">
<match url="^(.*)$" />
<conditions>
<add input="{HTTP_HOST}" pattern="^old.domain.com$" />
</conditions>
<action type="Redirect" url="http://new.domain.com/en-us/promotions/all" />
</rule>
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.