Redirect all naked domain urls to subdomain(www) urls preserving the url, except for one page on IIS/ASP.NET
问题 Whats the best way to achieve the above? I do know that it can be achieved at HttpModule level. Is it possible just via web.config(easier and faster to code execute). 回答1: It's easy to do this with the URL rewrite module through the web.config : <rewrite> <rules> <clear /> <rule name="Redirect naked domains to www.domain.com" stopProcessing="true"> <match url="(.*)" /> <conditions logicalGrouping="MatchAll"> <add input="{HTTP_HOST}" negate="true" pattern="^www\." /> <add input="{REQUEST_URI}"