Jump to content

Recommended Posts

Anyone know how to force URL with SSL with www.

 

 <rewrite>
            <rules>               
                  <rule name="Redirect to HTTPS" stopProcessing="true">
<match url="(.*)" />
<conditions><add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://www.site.com/{R:0}" redirectType="SeeOther" />
</rule>       
            </rules>
 </rewrite>

Please check the sample.
 

http://site.com to https://www.site.com

http://www.site.com to https://www.site.com

 

But when 

https://site.com to https://site.com

it doesn't add www on the site URL.

Anyone can help me.

Link to comment
https://forums.phpfreaks.com/topic/292332-force-www-on-https/
Share on other sites

  • 5 months later...

Anyone know how to force URL with SSL with www.

 

 <rewrite>
            <rules>               
                  <rule name="Redirect to HTTPS" stopProcessing="true">
<match url="(.*)" />
<conditions><add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://www.site.com/{R:0}" redirectType="SeeOther" />
</rule>       
            </rules>
 </rewrite>
Better try this:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Add www" patternSyntax="Wildcard" stopProcessing="true">
                    <match url="*" />
                    <conditions>
                        <add input="{HTTP_HOST}" pattern="www.fabrikam.com" negate="true" />
                    </conditions>
                    <action type="Redirect" url="http://www.fabrikam.com/{R:1}" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>
Link to comment
https://forums.phpfreaks.com/topic/292332-force-www-on-https/#findComment-1508789
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.