Show Mobile Navigation

Ads

Friday 4 April 2014

, ,

how to redirect with www to without www in .net

Unknown - Friday, April 04, 2014
Here am going to show how to redirect your domain from with www to without www using web.config in .Net. You can use this to your Domain or Subdomain with www to without www.

Ex: Redirect from www.mobiappsweb.com to mobiappsweb.com ... Redirect from http://www.ypages.mobiappsweb.com to http://ypages.mobiappsweb.com

Redirect Main Domain from www.mobiappsweb.com to without mobiappsweb.com
<system.webServer>
  <rewrite>
    <rules>
      <rule name="Redirect www sub-domain to domain" stopProcessing="true">
        <match url="(.*)" />
        <conditions>
          <add input="{HTTP_HOST}" pattern="^www\.mobiappsweb\.com$" />
        </conditions>
        <action type="Redirect" url="http://mobiappsweb.com/{R:1}" redirectType="Permanent" />
      </rule>
    </rules>
  </rewrite>
</system.webServer>


Redirect Main Domain from www.ypages.mobiappsweb.com to without ypages.mobiappsweb.com:

<system.webServer>
  <rewrite>
    <rules>
      <rule name="Redirect www sub-domain to domain" stopProcessing="true">
        <match url="(.*)" />
        <conditions>
          <add input="{HTTP_HOST}" pattern="^www\.ypages.mobiappsweb\.com$" />
        </conditions>
        <action type="Redirect" url="http://ypages.mobiappsweb.com/{R:1}" redirectType="Permanent" />
      </rule>
    </rules>
  </rewrite>
</system.webServer>

0 comments:

Post a Comment