Redirect to WWW using Web.config

Add the source code following in system.webServer section (web.config):

<rewrite>
  <rules>
    <rule name="WWW" stopProcessing="true" patternSyntax="Wildcard">
      <match url="*" />
      <conditions>
        <add input="{HTTP_HOST}" pattern="your-domain.com" />
      </conditions>
      <action type="Redirect" redirectType="Permanent" url="http://www.your-domain.com/{R:0}" />
    </rule>
  </rules>
</rewrite>
  • 2 Users Found This Useful
Was this answer helpful?

Related Articles

Sending e-mail from ASP.NET form (VB)

Try Dim SmtpClient As New Net.Mail.SmtpClient("mail.negox.com", 587) SmtpClient.EnableSsl =...

Connection string for Web.config

connectionString="Data Source=IP-ADDRESS;Initial Catalog=YOUR-DATABASE;User...

Redirect to HTTPS using Web.config

Add the source code following in system.webServer section (web.config): <rewrite>...

Enable error message for Web.config

To enable the details of this specific error message to be viewable on remote machines, please...

A Web Service example

In the following example we will use ASP.NET to create a simple Web Service that converts the...