Would this be done on the internal IIS web server
It's possible. There are several ways. I will show the way where you use the web.config
file. In your web.config
file put the following code:
<rewrite>
<rules>
<rule name="Redirect domain.com to www" patternSyntax="Wildcard" stopProcessing="true">
<match url="*" />
<conditions>
<add input="{HTTP_HOST}" pattern="domain.com" />
</conditions>
<action type="Redirect" url="http://www.domain.com/{R:0}" />
</rule>
</rules>
</rewrite>
Or if you want to use regular expressions:
<rewrite>
<rules>
<rule name="Redirect domain.com to www" patternSyntax="ECMAScript" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^domain.com$" />
</conditions>
<action type="Redirect" url="http://www.domain.com/{R:0}" />
</rule>
</rules>
</rewrite>
www
subdomain as covered in the second part of the answer here, then create a redirect rule for IIS as covered in this answer here. You can also do the later using a web.config file as William covered in his answer.