https://domain.com works, https://www.domain.com does not! Help!

Hi.

Can anyone point me in the right direction.

I have a domain that is hosted with iis7. The url rewrite module redirects all www.domain .com to domain.com and I have used the well documented rule to force the site to add https:// to the domain name.

Therefore I would expect all
http://www.domain.co.uk
http://domain.co.uk
https://www.domain.co.uk
https://domain.co.uk
www.domain.co.uk
domain.co.uk

should all go to https://domain.co.uk

But https://www.domain.co.uk gives a security error:

Your connection is not private
Attackers might be trying to steal your information from www.hunterbarrington.co.uk (for example, passwords, messages or credit cards). NET::ERR_CERT_COMMON_NAME_INVALID


My web.config is:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
                <httpErrors>
            <remove statusCode="500" subStatusCode="19" />
            <remove statusCode="500" subStatusCode="18" />
            <remove statusCode="500" subStatusCode="17" />
            <remove statusCode="500" subStatusCode="16" />
            <remove statusCode="500" subStatusCode="15" />
            <remove statusCode="500" subStatusCode="13" />
            <remove statusCode="500" subStatusCode="100" />
            <remove statusCode="500" subStatusCode="12" />
            <remove statusCode="404" subStatusCode="-1" />
            <error statusCode="404" subStatusCode="-1" prefixLanguageFilePath="" path="/site_error.asp" responseMode="ExecuteURL" />
        </httpErrors>
        <rewrite>
            <outboundRules>
                <preConditions>
                    <preCondition name="ResponseIsHtml1">
                        <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
                    </preCondition>
                </preConditions>
            </outboundRules>
            <rules>
                <rule name="CanonicalHostNameRule1">
                    <match url="(.*)" />
                    <conditions>
                        <add input="{HTTP_HOST}" pattern="^domain\.co\.uk$" negate="true" />
                    </conditions>
                    <action type="Redirect" url="http://domain.co.uk/{R:1}" />
                </rule>
                <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>
    </system.webServer>
</configuration>

My bindings attached as a screen shot.

The domain is on a dedicated ip address.
rwlloyd71Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David Johnson, CD, MVPOwnerCommented:
what is the exact certificate error?
it is probably the name on the certificate doesn't match
I'd use a redirect rule rather an url rewrite.
0
systechadminConsultantCommented:
Did u create A record for www and also please check the site content and also clear the browser history..
0
Henrik JohanssonSystems engineerCommented:
Certificate errors are raised when certificate isn't valid. www.domain.co.uk isn't the same thing as domain.co.uk.
Certificate either need to specify all names expected to be used (include both domain, co,uk and www,domain,co.uk in certificate) or be a wildcard certificate that allows *.domain.co.uk
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rwlloyd71Author Commented:
Thank you!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
DNS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.