0

I'm really struggling with this. I have tried no end of examples and everything I read tells me this should work, however, I'm no server expert so I may well have made some incorrect assumptions about what I have done.

Quite simply I have a site at https://xxxxx.co.uk if someone types in

I want them to be redirected to https://xxxxx.co.uk

Currently, I can get the Http to https working but not the www to non-www part (with or without the https bit). It just stays on the www.xxxxx.co.uk (http://www and https://www) and tells me about a security risk which makes sense. But I want it to go to my site.

Any help would be much appreciated as I have been at this all day.

I found this article enter link description here which covers nearly all scenarios except https://www.xxxxx.co.uk. This rule just doesn't seem to want to work

<system.webServer>
<rewrite>

    <rules>

        <rule name="RedirectWwwToNonWww" stopProcessing="false">
            <match url="(.*)" />
            <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                <add input="{HTTP_HOST}" pattern="^(www\.)(.*)$" />
              </conditions>
              <action type="Redirect" url="https://xxxxx.co.uk" redirectType="Permanent" />
        </rule>     

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

    </rules>

</rewrite>
djack109
  • 1,261
  • 1
  • 23
  • 42
  • I tested your code, and the www to non-www part can work on my side. please show me the security risk messgae, This problem seems to be caused by your certificate being invalid. – samwu May 28 '20 at 10:34
  • https://www.xxxxx.co.uk. This is the only rule doesn't seem to want to work – djack109 May 28 '20 at 15:22
  • Can you post your error message? – samwu May 29 '20 at 09:30

0 Answers0