次の方法で共有


URL Rewrite redirection rule to redirect Http To HttpsVirtual Directory

Very nice new feature in URL Rewrite is building very flexible  rules for redirection.

 Because we can  set only 1 URL for redirection in IIS 7.x so URL Rewrite can help setting multiple rules and here is very good example we have multiple OWA  Webs Apps on exchange box and each one is configured with different Host header.

And we are looking to make a rule using URL Rewrite to redirect any request to the right secure OWA folder   based on the URL:

Here is a sample: Need to be able to redirect both OWA URLs from HTTP to HTTPs using the correct OWA URL.
For example:

https://mail.contoso1.com should go to https://mail.contoso1.com/owa

https://mail.contoso2.com should go to https://mail.contoso2.com/owa
 

Using URL Rewrite

Microsoft URL Rewrite Module 2.0 for IIS 7 (x64)

Microsoft URL Rewrite Module 2.0 for IIS 7 (x86)

 The below Rule help to do that:

                <rule name="Canonical Host Name" enabled="true" stopProcessing="true">

                    <match url="(.*)" />

                    <conditions>

                        <add input="{HTTPS}" pattern="^OFF$" />

                    </conditions>

                    <action type="Redirect" url="https://{HTTP_HOST}/owa" />

                    <serverVariables>

                    </serverVariables>

                </rule>

 

Ref

https://www.iis.net/learn/extensions/url-rewrite-module/url-rewrite-module-video-walkthrough

https://blogs.iis.net/ruslany/archive/2009/04/08/10-url-rewriting-tips-and-tricks.aspx