Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simple IIS URL Rewrite

Simple question. I need to redirect all http 80 and https 443 requests on a specific subdomain URL to an alternative SSL port https 444.

Example: http://sub.corp.com --> https://sub.corp.com:444 Example: https://sub.corp.com --> https://sub.corp.com:444

I only wish to use IIS 7.5 URL Rewrite module.

Thanks.

like image 584
roadsunknown Avatar asked Dec 28 '22 12:12

roadsunknown


1 Answers

The following URL rewrite rule should do what you want:

<rewrite>
    <rules>
        <rule name="Redirect to port 444" stopProcessing="true">
            <match url="(.*)" />
            <conditions logicalGrouping="MatchAny">
                <add input="{HTTPS}" pattern="^ON$" negate="true" />
                <add input="{SERVER_PORT}" pattern="^444$" negate="true" />
            </conditions>
            <action type="Redirect" url="https://sub.corp.com:444/{R:0}" />
        </rule>
    </rules>
</rewrite>

It redirects to https://sub.corp.com:444 whenever HTTPS is not ON or when the port number is not 444. The site should have bindings to port 80 (with HTTP), 443 (with HTTPS for standards SSL) en 444 (with HTTPS) for this to work.

like image 71
Marco Miltenburg Avatar answered Dec 31 '22 01:12

Marco Miltenburg