I have a strange problem with IIS url_rewrite module and web.config setup. I think there is a problem with the matching pattern or I'm doing something completely wrong..
My setup is a ASP.Net MVC app with multi language support. For starters I have three languages enabled, English, German and French.. so you could access them with a language parameter www.domain.com/en/ www.domain.com/de/ www.domain.com/fr/.. now I bought a german domain and setup up the german part of the page to .de domain, so now I have www.domain.com/en/ www.domain.de/de/ www.domain.com/fr/ everything ok so far..
The problem i'm trying to figure out how to add a safe 301 redirect if you write www.domain.com/de/ to www.domain.de/de/ or vice versa www.domain.de/en/ back to www.domain.com/en/ ... the main reason i wan't to solve this its because of SEO to fix the duplicate content issues ..
I have IIS 8.5, url_rewrite module installed and now I'm stuck with this in the in my web.config
<rule name="DE Redirect" stopProcessing="true">
<match url="(.*)" ignoreCase="true" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTP_HOST}" pattern="^www\.domain\.com\/de\/$" />
</conditions>
<action type="Redirect" url="https://www.domain.de/de/{R:0}" redirectType="Permanent" />
</rule>
I want to redirect the user if they enter or get to www.domain.com/de/page1 to www.domain.de/de/page1 and only if there is the www.domain.com/de/ in the url, I won't redirect if they enter to english of french language website.
Any idea what am I doing wrong or what is the best way to debug such redirects.. I have tried with the Failed Request Tracing but didn't found anything helpful.
Any ideas? Cheers