1

I am looking for IIS Rewrite Rule to redirect from old domain to new domain along with appending querystring parameters to new domain. As I have gone through some articles but I am not getting. I am trying below Rule but its not working as expected(redirecting to new domain without querystring parameters)

<rewrite>
          <rules>
              <rule name="AllURLRedirect" stopProcessing="true">
                  <match url="http://olddomain.com/\b([-a-zA-Z0-9()@:%_\+.~#?&amp;//=]*)" />
                  <action type="Redirect" url="https://www.newdomain.com/{C:1}" redirectType="Permanent" />
              </rule>
          </rules>
</rewrite>

Please help me.

Thank you

2
  • If using a CDN (like Cloudflare and Akamai) it may be preferred to place the redirects in that system. Commented Sep 21, 2022 at 11:37
  • I am trying with IIS Rewrite Rule and in my local sitecore dev website. Commented Sep 21, 2022 at 11:41

1 Answer 1

1

You have to add appendQueryString="true" to your <action> tag:

<rule name="AllURLRedirect" stopProcessing="true">
    <match url="http://olddomain.com/\b([-a-zA-Z0-9()@:%_\+.~#?&amp;//=]*)" />
    <action appendQueryString="true" type="Redirect" url="https://www.newdomain.com/{C:1}" redirectType="Permanent" />
</rule>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.