0

We have a really simple URL rewrite rule that basically causes a 301 redirect to another domain:

<rewrite>
  <rule>
    <match url="^(default.aspx)?$" />
    <action type="Redirect" url="https://some.other.domain.com" />
  </rule>
</rewrite>

Unfortunately, when a URL like this is encountered:

http://original.domain.com/?returnUrl=https%3A%2F%2Fsome.url%2F

The redirect URL looks like this:

https://some.other.domain.com/?returnUrl=https://some.url/

Notice how the URL encoding is lost.

Is this a bug in the URL rewrite module? If so, how can one work around it?

Jacob
  • 77,566
  • 24
  • 149
  • 228

1 Answers1

0

I figured it out. The rewrite rule has only a partial redirect URL specified. Query string encoding is now preserved now that I changed this:

<action type="Redirect" url="https://some.other.domain.com"/>

...to this:

<action type="Redirect" url="https://some.other.domain.com/"/>

(note the trailing slash)

Jacob
  • 77,566
  • 24
  • 149
  • 228