HTTP to HTTPS Redirect - IIS 8.5 not working properly

后端 未结 3 705
小蘑菇
小蘑菇 2021-01-02 00:52

I\'ve read a number of posts here on SO as well as on the \'net (IIS blogs, etc.). I\'m trying to force all connections going from domain.com to www.domain.com and a

相关标签:
3条回答
  • 2021-01-02 01:17

    Edit: So I found this blog post: http://www.meltedbutter.net/wp/?p=231 and gave it a try and voila! Worked like a charm. Not sure why this worked over the rules posted above but in my case the below is working and successfully taking all non-www traffic and redirecting it to both www and https.

    <!-- Redirect to HTTPS -->
            <rewrite>
                <rules>
                    <rule name="http to https" stopProcessing="true">
                        <match url="(.*)" />
                        <conditions>
                            <add input="{HTTPS}" pattern="^OFF$" />
                        </conditions>
                        <action type="Redirect" url="https://www.domain.com/{R:1}" redirectType="SeeOther" />
                    </rule>
                </rules>
            </rewrite>
    
    0 讨论(0)
  • 2021-01-02 01:21

    This is a long shot for some cases but I had deleted my port 80 bindings for the website as I only wanted SSL / port 443. So from what I can tell is Port 80 binding is also needed for the the rewrite to work correctly.

    0 讨论(0)
  • 2021-01-02 01:30

    We faced same issue while redirecting from http to https using URL Rewrite module, But after switching off the require ssl module within IIS did the trick.

    1. Go to SSL Settings of website
    2. Uncheck require SSL checkbox.
    3. Apply settings and Restart iis
    0 讨论(0)
提交回复
热议问题