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

    Pertanyaan

  • 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

    <rewrite>
      <rules>
    	<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\.)(.*)$" />
    	 </conditions>
    	 <action type="Redirect" url="https://{C:2}/{R:1}" appendQueryString="true" />
    	</rule>
    	<rule name="Force HTTPS" enabled="true" stopProcessing="true">
    	 <match url="(.*)" />
    	 <conditions logicalGrouping="MatchAny">
    	 <add input="{HTTPS}" pattern="off" />
    	 </conditions>
    	 <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" />
    	</rule>
      </rules>
    </rewrite>


    Sabtu, 01 Desember 2018 04.35

Semua Balasan

  • 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.

    https://www.asp.net/

    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,

    Wendy


    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.

    Selasa, 04 Desember 2018 08.29