vendredi 7 décembre 2018

How to redirect non WWW to WWW in web.config

I'm tried here web.config redirect non-www to www

And tried:

<rule name="ensurewww" enabled="false" stopProcessing="true">
    <match url=".*" />
    <conditions>
         <add input="{CACHE_URL}" pattern="^(.+)://(?!www)(.*)" />
    </conditions>
    <action type="Redirect" url="{C:1}://www.{C:2}/{R:1}" redirectType="Permanent" />
</rule>

Result: 1. abc.com ---> www.abc.com True

Result 2. abc.com/a.aspx--->www.abc.com/a.aspx False

Result 3. abc/com/abc---->www.abc.com/abc False

Finally: I want to Result 2 and Result 3 is True




Aucun commentaire:

Enregistrer un commentaire