Redirect https://www to none www not working in asp.net RRS feed

  • Question

  • My web using code asp.net (C#) in visual studio 2015. My web using ssl not redirect https://www to none www hicc.

    ex: https://www.trungtamthuoc.com error to https://trungtamthuoc.com

    while www.trungtamthuoc.com redirect good to https://trungtamthuoc.com

    Code redirect in web.config : hellp me huhuhu

    	<rule name="Force non-WWW" enabled="true" stopProcessing="true">
    	 <match url="(.*)" />
    	 <conditions logicalGrouping="MatchAny">
    	 <add input="{HTTP_HOST}" pattern="^(www\.)(.*)$" />
    	 <add input="{HTTPS_HOST}" pattern="^(www\.)(.*)$" />
    	 <action type="Redirect" url="https://{C:2}/{R:1}" appendQueryString="true" />
    	<rule name="Force HTTPS" enabled="true" stopProcessing="true">
    	 <match url="(.*)" />
    	 <conditions logicalGrouping="MatchAny">
    	 <add input="{HTTPS}" pattern="off" />
    	 <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" />

    Saturday, December 1, 2018 4:35 AM

All replies

  • Hi MiliStore,

    Thank you for posting here.

    Since your question is more related to ASP.NET, you could post a new thread in ASP.NET forum for suitable support.


    The CLR Forum discuss and ask questions about .NET Framework Base Classes (BCL) such as Collections, I/O, Regigistry, Globalization, Reflection. Also discuss all the other Microsoft libraries that are built on or extend the .NET Framework, including Managed Extensibility Framework (MEF), Charting Controls, CardSpace, Windows Identity Foundation (WIF), Point of Sale (POS), Transactions.

    Best Regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, December 4, 2018 8:29 AM