I am dealing with some client's that use Windows servers and as such do not support .htaccess files. This is not a huge deal but, my concern is this:
I have a rule set up in my .htaccess file to redirect the non-www version of the site to the www version. This makes the URL's look nicer and prevents duplicate content being indexed.
However, there does not seem to be a simple way to do this on a Windows server. I have read through tutorials on setting up a web.config file but, my Windows server experience is very limited and many times I only have FTP access to the site (no server access).
Any ideas on a quick and fairly simple solution, that I could use?
Create web.config (in the root directory) file with the next content:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<rewrite>
<rules>
<rule name="CanonicalHostNameRule" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www\.domain\.com$" negate="true" />
</conditions>
<action type="Redirect" url="http://www.domain.com/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
The URL Rewrite Module (at least version 2.0) has to be installed.