Redirect multiple bindings to their https- and www-versions

Carsten Gerwing asked on July 31, 2017 16:22

Hi,

we have multiple kentico instances running on a single IIS site. SSL certificates for all used domains are installed, but only for the www.domainname.com bindings and NOT for the domainname.com bindings.

How do I redirect the single bindings without www-prefix to their https- and www-versions?

Is this possible or are ssl certificates for both (with and without www-prefix) necessary?

Correct Answer

Carsten Gerwing answered on August 3, 2017 10:23

Unfortunately our certificates didn't cover both (with and without the www-prefix) so we had to order additional ones for our domains... With all necessary certs in place everything works as it should.

1 votesVote for this answer Unmark Correct answer

Recent Answers


Trevor Fayas answered on July 31, 2017 18:12

In Kentico way: Settings>URLs & SEO>SEO - URLs>Process domain prefix and set to "always use domain with WWW prefix". This will force your domain to use WWW. (Copied from Brenden). Just be careful if you have staging sites that you disable this on the staging site (since staging.____.com would force redirect to www.___.com)

Another classical option is to use the URL rewrite Module (Install Microsoft's Web Platform installer and then search for URL Rewrite), then set the rule: https://weblogs.asp.net/owscott/iis-url-rewrite-rewriting-non-www-to-www

This works better if you have staging/dev sites or subdomains, as you can specify ONLY non www redirect to www.

0 votesVote for this answer Mark as a Correct answer

Dražen Janjiček answered on August 2, 2017 11:27 (last edited on August 2, 2017 11:28)

SSL certificates commonly cover the domain so having www or not shouldn't make a difference. I usually use the IIS Rewrite module. A simple non-www to www (https) redirect could look like this:

<rule name="Redirect yourdomain.com to www" patternSyntax="Wildcard" stopProcessing="true">
  <match url="*" />
  <conditions>
    <add input="{HTTP_HOST}" pattern="yourdomain.com" />
  </conditions>
  <action type="Redirect" redirectType="Permanent" url="https://www.yourdomain.com/{R:0}" />
</rule>
0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.