Portal
Language
 
Home>Knowledge Base>Root>Getting Started>Rewriting Non WWW to WWW URL (IIS7 Servers Only)
User Login
Username
Password
 
 Login
Information
Article ID85
Created On5/1/2009
Modified5/1/2009
Share With Others

Rewriting Non WWW to WWW URL (IIS7 Servers Only)

This article applies only to Windows 2008 servers with IIS7 (sites hosted on our raptor13 or newer). It explains how to use the IIS Rewrite Module to direct incoming traffic for http://domainname.com to http://www.domainname.com, a popular thing to do for SEO.

Step 1: Download the web.config file from your site root folder.

Step 2: Open this file in your favorite text editor and insert the following redirection code inside the <configuration> tags.

<system.webServer>
    <rewrite>
        <rules>
        <clear />
        <rule name="WWW Rewrite" enabled="true">
            <match url="(.*)" />
            <conditions>
                <add input="{HTTP_HOST}" negate="true" pattern="^www\.([.a-zA-Z0-9]+)$" />
            </conditions>
            <action type="Redirect" url="http://www.{HTTP_HOST}/{R:0}" appendQueryString="true" redirectType="Permanent" />
        </rule>
        </rules>
    </rewrite>
<system.webServer>


Step 3: Save the file and upload it back to your FTP


If if the <system.webServer> already exists in your web.config place the code minus the <system.webServer> tags inside the existing tag structure.