1

I want to redirect a SEO-Friendly outgoing link like example.com/out/productxyz with IIS 8.5. So I created a Rewrite-Rule with the Action-Type forward. The target URL has Parameters, e.g. example.com/action.aspx?param1=value&param2=value

The Problem is: When the IIS is saving the rule, the '&' chars from the parameters are converted to their HTML-Values:

<action type="Redirect" url="http://example.com/action.aspx?param1=value&amp;amp;param2=value" redirectType="Found" />

So a '&' is converted to '&amp;'. I took a look in the header and the IIS is exactly redirecting to 'http://example.com/action.aspx?param1=value&amp;param2=value'. This breaks because of the '&amp;' and so I get another side, and not the one which I would get with correct parameters.

I already tried to replace all '&amp;' to '&' in the web.config, but then I got an error in IIS that the config isn't a well-formed xml. So my question: How can I redirect a custom URL to a target URL with URL-Parameters, without broke the parameters?

Andrew Schulman
  • 8,811
  • 21
  • 32
  • 47
Lion
  • 506
  • 10
  • 21

1 Answers1

1

the value in web.config should look like

<action type="Redirect" url="http://example.com/action.aspx?param1=value&amp;param2=value" redirectType="Found" />

not (notice the extra amp; you have here)

<action type="Redirect" url="http://example.com/action.aspx?param1=value&amp;amp;param2=value" redirectType="Found" />
ahmelsayed
  • 841
  • 7
  • 3