0

I need to create an URL rewrite so that when the users type: mydomain.com/test123 the server gets: mydomain.com/?test123.

I tried this:

<rule name="UF" stopProcessing="true"> <match url="example.com/([_0-9a-z-]+)" /> <action type="Redirect" url="https://example.com/?{R:1}" /> </rule>

  • check this: [https://stackoverflow.com/questions/19165676/iis-url-rewrite-not-working-with-query-string](https://stackoverflow.com/questions/19165676/iis-url-rewrite-not-working-with-query-string) – Hadi Samadzad Dec 09 '19 at 12:47
  • Also check Mistake 1, https://blog.lextudio.com/the-very-common-mistakes-when-using-iis-url-rewrite-module-a2ab7e4fee59 – Lex Li Dec 09 '19 at 13:46

1 Answers1

0

According to your description, I suggest you could try to use below url rewrite rule.

            <rule name="UF" stopProcessing="true">
                <match url="([_0-9a-z-]+)" />
                <action type="Redirect" url="https://example.com/?{R:1}" appendQueryString="false" />
            </rule>

Result:

enter image description here

Brando Zhang
  • 22,586
  • 6
  • 37
  • 65