Force https with URL rewrite

For most sites, after installing a SSL certificate, https can be forced by adding a URL rewrite rule to the site's web.config file.  Though, please note it will not apply to all sites, for example it may not work for those using routing or it may conflict with any existing URL rewrite rules.  In the case of a CMS like WordPress or nopCommerce, it is often a setting within the CMS itself.  The URL rewrite rule also will not work for ASP.NET Core sites (see below).
URL rewrite rule to redirect all requests to https
<?xml version="1.0" encoding="UTF-8"?>
        <rule name="Redirect to https" stopProcessing="true">
          <match url=".*" />
            <add input="{HTTPS}" pattern="off" ignoreCase="true" />
          <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />
Redirect to https in Core

For Core apps, UseHttpsRedirection middleware can be used to force https by adding app.UseHttpsRedirection(); to the startup.cs as in the example below

  public void Configure(IApplicationBuilder app, IWebHostEnvironment env)

More detailed information can be found after the link