我想redirect一个search引擎友好的输出链接像example.com/out/productxyz与IIS 8.5。 所以我用Action-Type向前创build了一个Rewrite-Rule。 目标url具有参数,例如example.com/action.aspx?param1=value¶m2=value
问题是:当IIS保存规则时,参数中的“&”字符将转换为其HTML值:
<action type="Redirect" url="http://example.com/action.aspx?param1=value&amp;param2=value" redirectType="Found" />
所以一个'&'被转换成'&amp;'。 我看了一下头,IIS正在redirect到“ http://example.com/action.aspx?param1=value&param2=value ”。 这是因为“&amp;” 所以我得到另一面,而不是我会得到正确的参数。
我已经试图取代所有'&amp;' 到'&'在web.config中,但后来我得到了错误在IIS中,该configuration不是一个良好的formsXML。 所以我的问题:我怎样才能redirect一个自定义的URL到URL参数的目标URL,而不会破坏参数?
web.config的值应该看起来像
<action type="Redirect" url="http://example.com/action.aspx?param1=value&param2=value" redirectType="Found" />
不(注意额外的amp;你在这里)
<action type="Redirect" url="http://example.com/action.aspx?param1=value&amp;param2=value" redirectType="Found" />