On the same website in IIS, we have 2 bindings with domain names "old.example.org" and "new.example.org".

When someone calls "https://old.example.org/abc/?xyz=123", I would like to send a permanent redirect to "https://new.example.org/abc/?xyz=123"

If I use the Http Redirect module of IIS, I get an infinite redirection because both domain name target the same website.

I could do it in the application code, but really it would be much better to do it in IIS or somewhere before, is it possible to set this kind of permanent redirect at a another level than IIS or differently in IIS to avoid infinite loop ?

  • That's odd... I do this exact thing to move from www.domain to domain (no sub domain). I'd guess your redirect is slightly incorrect?
    – Dave
    Sep 17 '20 at 15:59
  • Give details about your redirect.
    – harrymc
    Sep 17 '20 at 16:02

You can use URL rewrite module

<rule name="CanonicalHostNameRule" patternSyntax="ECMAScript" stopProcessing="true">
          <match url="^(.*)$" />
            <add input="{HTTP_HOST}" pattern="^old.example.org$" />
          <action type="Redirect" url="https://new.example.org/{R:1}" />

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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