There is some debate whether or not the www prefix should be used on your domain space, there is at least certainly no technical reason why this would be required as it is simply DNS configuration. One thing that should not be up for debate though is that you should ensure that your users are able to access your sites in a consistent manner regardless of whether you us a non-www or www name space. In this this guide we'll use ISAPI Rewrite for IIS to show you how to redirect all your non-www requests to your www address. For example, if a user tries to access your site via http://example.com they will be redirected using the 301 HTTP status code to http://www.example.com .
Using a URL Rewrite tool such as the popular ISAPI Rewrite 3 by Helicontech you can manipulate the URL to include the www prefix using the following code;
RewriteEngine on
RewriteCond %{HTTPS} (on)?
RewriteCond %{HTTP:Host} ^(?!www\.)(.+)$ [NC]
RewriteCond %{REQUEST_URI} (.+)
RewriteRule .? http(?%1s)://www.%2%3 [R=301,L]Before this code will work you need to ensure that you have configured the appropriate DNS A records for your www and non-www address. If you are hosting multiple websites on a single IP address, you'll also need to verify that you have configured the appropriate host headers in IIS. If you have any comments or feedback, please feel free to post them here. If you require any specific help with your environment please post a new thread in the forums and I'll do my best to help.
There are no downloads yet.