I want to implement redirects on an IIS7 webserver. Basically, if the subdomain is not included in the URL, I will redirect to the www subdomain.
http://mysite.com/file.aspx redirects to http://www.mysite.com/file.aspx
http://mysite.com/image.jpg redirects to http://www.mysite.com/image.jpg
http://mysite.com/text.html redirects to http://www.mysite.com/text.html
How to do this?
I do not want to write any HTTP Module — it must be done thru IIS config only.
Also, I am required to use Classic Pipeline mode and cannot install any ISAPI plugins.
Is it possible?
This solution worked for me:
1) Install URL Rewrite component:
http://www.iis.net/download/urlrewrite
2) Add to web.config: