1

I have a azure web app which uses custom domain from godaddy.

I got the SSL certificate from namecheap.com and applied binding to both mathanka.com and www.mathanka.com When i enter manually it works fine. I used web.config with below mentioned rules.

<configuration>
<system.webServer>
    <rewrite>
        <rules>
            <clear />
            <rule name="Redirect to https" stopProcessing="true">
                <match url="(.*)" />
                <conditions>
                    <add input="{HTTPS}" pattern="off" ignoreCase="true" />
                </conditions>
                <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" appendQueryString="false" />
            </rule>
        </rules>
    </rewrite>
<staticContent>
  <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="1.00:00:00" />
</staticContent>
</system.webServer>

but its not redirecting to https:// url : mathanka.com

Please guide me the solution and step to take.

Thanks.

Mathan K A
  • 115
  • 1
  • 2
  • 10
  • Is it an ASP.Net MVC app? – Vivien Chevallier Dec 04 '16 at 15:42
  • No sir. it is just static website built on html and javascript. hosted on azure web app. – Mathan K A Dec 05 '16 at 07:36
  • To mention, the rule which i mentioned above is working at some cases. for example, in chrome, Even after clearing cookies and history, when i first load. https is not appearing. but when i again reload with ctrl + R. then it appears with https: my doubts is even though we clear all cookies and history why its not appearing in first load? Awaiting for the solution Thanks, – Mathan K A Dec 05 '16 at 17:03
  • Did you get the solution for it? – A_01 Sep 29 '18 at 09:00

1 Answers1

0
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <clear />
                <rule name="Redirect to https" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions>
                        <add input="{HTTPS}" pattern="off" ignoreCase="true" />
                    </conditions>
                    <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

This is the copy\paste from here.

Community
  • 1
  • 1
4c74356b41
  • 69,186
  • 6
  • 100
  • 141