简体   繁体   中英

Web.config rewrite rule not working in Google Chrome

When I visit mycompany.com in any browser except chrome, it successfully redirects to https://www.mycompany.com . However in Chrome I just get a 404, ditto all chrome users.

In web.config I have this redirect rule

<rewrite>
  <rules configSource="">
    <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="true" />
    </rule>
  </rules>
</rewrite>

Which I think is what makes it work in other browsers.

I've tried adding a HTTP redirect dns record, but that doesn't seem to have helped.

Open a incognito tab and verify that it is redirecting to the URL you want it to.

Close incognito tab

Clear Google Chrome cache

It should then redirect you without having to use incognito mode

i don't really have a explanation. I'm using this myself.

<rewrite>
      <rules>
        <rule name="HTTP to HTTPS redirect" stopProcessing="true">
          <match url="(.*)" />
          <conditions>
            <add input="{HTTPS}" pattern="off" ignoreCase="true" />
          </conditions>
          <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />
        </rule>
      </rules>
    </rewrite>

they look very similar but I have not seen problems in redirection to https. Maybe its something else thats cauzing the 404?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM