We have a website that is hosted on IIS7 and which is bound to several domains. The site is localized in multiple languages and part of the URL holds the language code, for example www.mysite.com/en, www.mysite.com/cs, www.mysite.com/hu, etc.

When the user requests the website under a country level domain, we would like to redirect them to the main (.com) domain, but add a language parameter, so that this should happen:

  • user requests www.mysite.cz -> gets redirected to www.mysite.com/cs
  • user requests www.mysite.hu -> gets redirected to www.mysite.com/hu

Is this possible with IIS URL Rewrite Module 2.0? If so, how do I do this?

link|improve this question
feedback

1 Answer

up vote 0 down vote accepted

OK, I'll answer myself. Here's how to do this:

Go to the website in IIS and add a new rewrite rule.
Set Match URL to .*
Add a Condition, where {HTTP_HOST} matches the pattern of ^www.mysite.cz$
Add an Action of Redirect type and Redirect URL http://www.mysite.com/cs

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.