Reputation: 1
Looking for IIS rewrite rule for HTTPS://example.co.uk to HTTPS://www.example.co.uk I have been able to redirect HTTP://example.co.uk & HTTP://www.example.co.uk to HTTPS://www.example.co.uk but unable to create a rule to redirect HTTPS://example.co.uk to HTTPS://www.example.co.uk In IIS the site bindings i have are: http www.example.co.uk 80 http example.co.uk 80 https www.example.co.uk 443
<rule name="https" patternSyntax="Wildcard" stopProcessing="true">
<match url="*" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{REQUEST_URI}" pattern="https://example.co.uk/*" />
</conditions>
<action type="Redirect" url="https://www.{C:0}/{R:1}" />
</rule>
Not very experienced in creating rewrite rules they are already populated from past colleagues Any assistance would be good : )
Upvotes: 0
Views: 130
Reputation: 1
Cheers for your help Lex & Jalpa. I ended up creating site with https www site and adding redirect to the https domain.com site it works
Upvotes: 0
Reputation: 12749
you could try below rule:
<rule name="RedirectNonWwwToWww" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="on" />
<add input="{HTTP_HOST}" pattern="^example.co.uk$" />
</conditions>
<action type="Redirect" url="https://www.{C:0}/{R:0}" redirectType="Permanent" />
</rule>
Upvotes: 1