I have an application written on ASP.NET MVC (V 1.0). The application runs on IIS7 and the DNS is provided by GoDaddy.
I would like to forward any request that comes from http://mydomain.example/ctrlr/act/value
to a URL of this form: http://WWW.mydomain.example/ctrlr/act/value
Basically, I want to add WWW to the Host-name if someone tries to reach http://mydomain.example
What would be the best way to do this?
I think you will find an answer that suits from this question
I would agree with your idea of forcing the use off www, as though Stack Overflow decided to use it I do believe they regretted when tweaking performance for cookies and having to use sstatic.net instead of images.stackoverflow.com say.
To save you a redirect here is gist of what you need to do.
Here’s the IIS7 rule to add the WWW prefix to all incoming URLs. Cut and paste this XML fragment into your web.config file under
<system.webServer> / <rewrite> / <rules>
<rule name="Add WWW prefix" >
<match url="(.*)" ignoreCase="true" />
<conditions>
<add input="{HTTP_HOST}" pattern="^domain\.com" />
</conditions>
<action type="Redirect" url="http://www.domain.example/{R:1}"
redirectType="Permanent" />
</rule>