Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have a website stored on azure for which I got an SSL certificate. I am trying to redirect www.mywebsite.com to https://www.mywebsite.com but with no success.

I am using the following code that should change the configuration of IIS where my project is deployed :

<system.webServer>
<rewrite>
  <rules>
    <rule name="Redirect to HTTPS">
      <match url="(.*)" />
      <conditions>
        <add input="{HTTPS}" pattern="off" ignoreCase="true" />
        <add input="{URL}" pattern="/$" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
      </conditions>
      <action type="Redirect" url="https://{SERVER_NAME}/{R:1}" redirectType="SeeOther" />
    </rule>
  </rules>
</rewrite>

But when I type my URL it does not redirect to https.

By the way, rewrite appears unrecorgnized by Intellisense.

share|improve this question
1  
Related - make sure you read it: stackoverflow.com/questions/4365294/… –  Timothy Shields Jul 1 '13 at 17:19

1 Answer 1

up vote 4 down vote accepted

I can see that you've taken the code snipet from Steve Marx example

The problem is that you have whitespace in your rule name. Just remove them and it will work.

The name attribute of rule must not have spaces; the rule won’t work correctly in IIS on Azure with spaces in the name.

Find the full article here: Azure https guide

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.