Hello,
I am pretty new using the URL rewrite module so everything i accomplished so far was by using trial and error.
Currently i am testing the URL rewrite module with our ASP.NET application to change the language based on the domain extension used to access the website.
In production therere currently is a Canonical Domain rule which redirects all the domains to the main .com domain. So when a user goes to www.example.nl or www.example.de the url gets redirected to www.example.com. This works like a charm and i am very happy with it.
Now i want to redirect the url to include the language based on the domain the site is being accessed. For example when a users accesses the url www.example.nl he ends up being redirected to www.example.com/lang/nl-nl which automatically changes his language to dutch.
Right now i was able to create a rewrite rule which successfully redirected to www.example.nl/lang/nl-nl but didn't change the domain to .com/lang/nl-nl. Instead it shows the original url (www.example.nl) without adding /lang/nl-nl in the url but it did change the language and thus redirected succesfully to /lang/nl-nl. I also want it to redirect to www.example.com AND show www.example.com/lang/nl-nl in the address bar.
The rule i used is the following:
<rewrite><rules><rule name="Example-NL" stopProcessing="true"><match url="(.*)" /><conditions><add input="{HTTP_HOST}" pattern="^example/.nl$" /></conditions><action type="Redirect" url="/lang/nl-nl" /></rule></rules></rewrite>
Should i use multiple rules to redirect and then rewrite the url?
In the future there are multiple domains that should be used this way as well as www.example.com always being redirected to www.example.com/lang/en-us
Many thanks in advance for your help!
Regards,
Dave