Tuesday, 6 December 2016

How To Redirect Non-www to www in Asp.net

Please Follow Below Set of Steps to Redirect Non-www To www for your domain in asp.net or asp classic Web Application : -

1. Open web.config file of your Web Application
2. Before Closing of </system.webserver> Add below code in order to redirect your domain
    from xyz.com to http://www.xyz.com for all pages of your website -

                  <rule name="Redirect domain.com to www" patternSyntax="ECMAScript" stopProcessing="true">
                  <match url=".*" />
                     <add input="{HTTP_HOST}" pattern="^xyz.com$" />
                  <action type="Redirect" url="http://www.xyz.com/{R:0}" />

3. Save web.config file and Upload it to Hosting Server
4. Now every request to xy.com will be rewritten with http://www.xyz.com

Share this

1 Response to "How To Redirect Non-www to www in Asp.net"

  1. Top notch article! Were linkimg tto this particularly great article on our website.
    Keep up
    the great writing.