2

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?

0

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

  • 1
    lol, got downvoted on my own reply which is the correct & actual solution I used to my own problem. Great, thanks! – Pawel Krakowiak Jul 12 '17 at 9:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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