0

my current configuration is:

<rule name="Force HTTPS" enabled="true">
    <match url="(.*)" ignoreCase="false" />
    <conditions>
        <add input="{HTTPS}" pattern="off" />
    </conditions>
    <action 
        type="Redirect" 
        url="https://{HTTP_HOST}{R:1}" 
        appendQueryString="true" 
        redirectType="Permanent" />
</rule>

and links to the http do not work. but when you type in the direct (main) url, the rule described above does work. The links listed on Google do not work; they are without https but the rule should redirect them right? I don't get it.

when I go directly to an image example: http://www.domain.com/img.jpg that does not work. https does (when entered manually) what did I do wrong?

Now I have found this website with a sample: http://www.sslshopper.com/iis7-redirect-http-to-https.html

<rule name="HTTP to HTTPS redirect" stopProcessing="true">
    <match url="(.*)" />
    <conditions>
        <add input="{HTTPS}" pattern="off" ignoreCase="true" />
    </conditions>
    <action 
        type="Redirect" 
        url="https://{HTTP_HOST}/{R:1}" 
        redirectType="Found" />
</rule>

but that doesn't look so much different. why does my config not redirect google links and direct links to images, but does redirect the main domain. all direct deep links to pages do not work with http. I get a server not found exception...

Edit: require ssl is not checked in the iis manager

Edit 2:

this seems to work:

<rule name="Force HTTPS" stopProcessing="true">
    <match url="(.*)" />
    <conditions>
        <add input="{HTTPS}" pattern="off" />
    </conditions>
    <action 
        type="Redirect" 
        url="https://{HTTP_HOST}/{R:1}" 
        appendQueryString="true" 
        redirectType="Permanent" />
</rule>

but that does not work for: http://www.domain.com/app_themes/themeName/img.jpg

and for http://www.domain.com/urlrewritten (rewritten with maproutes in global.asax)

0
<rule name="Force HTTPS" stopProcessing="true">
    <match url="(.*)" />
    <conditions>
        <add input="{HTTPS}" pattern="off" ignoreCase="true"/>
    </conditions>
    <action 
        type="Redirect" 
        url="https://{HTTP_HOST}/{R:1}" 
        appendQueryString="true" 
        redirectType="Permanent" />
</rule>

works, also with url rewriting of mapping routes etc. tested in internet explorer, firefox and chrome :)

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.