mercredi 29 avril 2015

Windows Azure: redirect website from www to non-www

I have this web.config file on my server.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.webServer>
    <rewrite>
        <rules>
            <rule name="HTTP to HTTPS redirect" stopProcessing="true">
                <match url="(.*)" />
                  <conditions>
                    <add input="{HTTPS}" pattern="off" ignoreCase="true" />
                  </conditions>
                <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />
            </rule>
            <rule name="Rule" stopProcessing="true">
                <match url="^(.*)$" ignoreCase="false" />
                    <conditions>
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                        <add input="{URL}" pattern="^/favicon.ico$" ignoreCase="false" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="index.php/{R:1}" appendQueryString="true" />
            </rule>
        </rules>
    </rewrite>

    <staticContent>
        <mimeMap fileExtension=".json" mimeType="application/json" />
        <mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
    </staticContent>
</system.webServer>
</configuration>

I want to redirect URL from www to non-www. For example, if user types www.exmaple.com, it should go to https://example.com

How can I edit such a thing in above code. Thanks.

Aucun commentaire:

Enregistrer un commentaire