ASP.Net-HTTP到HTTPS重写模块在字符'&';存在于URL字符串中

ASP.Net-HTTP到HTTPS重写模块在字符'&';存在于URL字符串中,asp.net,url-rewriting,Asp.net,Url Rewriting,当URL中有字符“&”时,我的URL HTTP到HTTPS重写不起作用 找不到410页的结果 结果为410的示例是 或 但是,如果上述URL中的“&”替换为“and”,则页面将正确加载 我有两条规则可以将HTTP重写为HTTPS。一个是存在非www的地方,另一个是存在www的地方 <rule name="CanonicalHostNameRule1"> <match url="(.*)" /> <conditions> <add input=

当URL中有字符“&”时,我的URL HTTP到HTTPS重写不起作用

找不到410页的结果

结果为410的示例是

但是,如果上述URL中的“&”替换为“and”,则页面将正确加载

我有两条规则可以将HTTP重写为HTTPS。一个是存在非www的地方,另一个是存在www的地方

  <rule name="CanonicalHostNameRule1">
<match url="(.*)" />
<conditions>
  <add input="{HTTP_HOST}" pattern="^www\.curtainsmadesimple\.co\.uk$" negate="true" />
</conditions>
<action type="Redirect" url="https://www.curtainsmadesimple.co.uk/{R:1}" />


有人能告诉我为什么我会遇到这个问题吗


提前谢谢。

我相信它会奏效的。这对我有用

<rewrite>
  <rules>
     <clear />
         <rule name="Redirect to https" stopProcessing="true">
            <match url=".*" />
               <conditions>
                  <add input="{HTTPS}" pattern="off" ignoreCase="true" />
               </conditions>
             <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />
         </rule>
  </rules>


谢谢你回复我。如果URL没有www前缀怎么办?如果URL没有www前缀怎么办?例如:@willcms您在使用SSL吗?我没有看到。是的,我有一个SSL。我尝试使用你的规则,但我的网站返回了一个500错误。从那以后,我又回到了原来的两条规则。@willcms您在哪一部分添加了内容?
<rewrite>
  <rules>
     <clear />
         <rule name="Redirect to https" stopProcessing="true">
            <match url=".*" />
               <conditions>
                  <add input="{HTTPS}" pattern="off" ignoreCase="true" />
               </conditions>
             <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />
         </rule>
  </rules>