I have a working 301 redirect setup for languages that looks like this:

<rule name="mygreatrule" stopProcessing="true">
    <match url="^productname" />
    <conditions logicalGrouping="MatchAll">
        <add input="{HTTP_HOST}" pattern="^(www\.)?example1.com$" />
        <add input="{QUERY_STRING}" pattern="lang=(de|fr|is|es)" />
    <action type="Redirect" url="https://www.example2.com/abcd/{C:1}/product/myproduct/productname" appendQueryString="false" redirectType="Permanent" />

But this works for example for URLs like


How would I have to change this redirect, if the string "?lang=de" would be optional? So for example


and I'd like to redirect this one to the en version of the site.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.