Search code examples
wordpressiisurl-rewriting

IIS URL redirection after the url redirection (used exact match) it shows same from URL only


IIS URL redirection after the url redirection (used exact match) it shows same from URL only. like this (faq/general-information/can-i-check-the-status-of-my-orders/?lang=zh-hans). I want redirect this url

From url: localhost:96/faq/general-information/can-i-check-the-status-of-my-orders/?lang=zh-hans

To url: https://stackoverflow.com/questions/ask

After the redirection I am getting this url localhost:96/faq/general-information/can-i-check-the-status-of-my-orders/?lang=zh-hans. I don't know why. What happened?


Solution

  • From your description, I think you want to create a redirect rule that will localhost:96/faq/general-information/can-i-check-the-status-of-my-orders/?lang=zh-hans redirect to https://stackoverflow.com/questions/ask

    Please try using the following rule:

    <rewrite>
       <rules>
          <rule name="GMDRedirect29" stopProcessing="true">
             <match url="faq/general-information/can-i-check-the-status-of-my-orders" />
             <conditions>
                <add input="{QUERY_STRING}" pattern="lang=zh-hans" />
             </conditions>
             <action type="Redirect" url="https://stackoverflow.com/questions/ask" />
          </rule>
        </rules>
    </rewrite>