0
votes

I have a site at domain.com. I've recently installed an SSL certificate so I can use HTTPS.

In IIS, I created bindings for domain.com and www.domain.com for http and https. Then I have a URL rewrite rule in my web.config that adjusts every url to point to https://domain.com

My issue is that when I go to http://domain.com or https://domain.com the site works, but http://wwww.domain.com and https://www.domain.com do not. Is this an issue with my rewrite rules or my binding?

Here is my web.config for reference:

<configuration>
<system.webServer>
    <rewrite>
        <rules>
<rule name="Redirect to HTTPS" stopProcessing="true">
  <match url="(.*)" />
  <conditions>
    <add input="{HTTPS}" pattern="^OFF$" />
  </conditions>
  <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Found" />
</rule> 
            <rule name="Imported Rule 1">
                <match url="^(register)$" />
                <conditions logicalGrouping="MatchAll">
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                </conditions>
                <action type="Redirect" url="https://domain.com/register.php" redirectType="Found" />
            </rule>
        </rules>
    </rewrite>
</system.webServer>

1

1 Answers

0
votes

i have solve this problem like this code block.

  <rewrite>
        <rules>
            <rule name="http to https" stopProcessing="true">
                <match url="(.*)" />
                <conditions>
                    <add input="{HTTPS}" pattern="^OFF$" />
                </conditions>
                <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Temporary" />
            </rule>
        </rules>
    </rewrite>