IIS redirect to www

Published on Author JFLeave a comment

You need a simple way to redirect your website from domain.com to www.domain.com. This can be used to redirect from HTTP to HTTPS, as well.

Microsoft Internet Information Services (IIS) comes with URL Rewrite. It may or may not be installed. The below guide will help you to install and configre URL Rewrite.

Open IIS Manager and click on your site to check for URL being installed. You an install it through the Web Platform Installer (very useful to have), or just download it from the link above.iis-url-rewrite-1

Using the Installer, seach for URL Rewrite. You can select it, then click Install.


Once installed, click on your site, then double click URL Rewrite.


Now click Add Rules

Conveniently, this “default” redirect is already there for you to select.

Step back: this dropdown list you will see is related to your site bindings. You might need to go back and make sure you have all your bindings in place. Note that I don’t have HTTPS in here. You could select that, as well if you wanted everything to redirect to https://www.domain.com

Here’s the prompt for selecting the canonical domain name, listed from the site bindings

Now that the rule is added, you want to confirm the rules, so click Edit. You can also rename it by clicking Rename.


Review and scroll down to the bottom. Confirm the Action type is Redirect and the redirect type. For SEO you want this to be a 301, meaning the “real” site lives only at www.domain.com. Make sure to hit apply if you update anything, then click Back to Rules.

Note: see the “Append Query String”? If you have http://domain.com/xyz=1  it will redirect to http://www.domain.com/xyz=1. This should be checked by default and is recommended.


That’s it, you’re done!

Additional information:

Here’s the web config:

<?xml version="1.0" encoding="UTF-8"?>
 <rule name="CanonicalHostNameRule1">
 <match url="(.*)" />
 <add input="{HTTP_HOST}" pattern="^www\.processio\.com$" negate="true" />
 <action type="Redirect" url="http://www.processio.com/{R:1}" />



Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.