Billing Linux cPanel Windows Control Panel Client Voip ms sql webadmin ms sql backup mysql webadmin Server Status

Main Menu
  • How to force redirect HTTP to HTTPS

    2 comments April 3rd, 2018 331

    Forcing or redirecting your visitors to https automatically is the best way to make sure that your website can only accessed through SSL and that all traffic to and from your website is secured. We recommend that all customers who use SSL make sure that their sites contain one of the below rules.

    IIS – web.config or Helicon Ape

    For URL Rewrite, add the following rewrite rule to your web.config file’s <rewrite> section, this rule must be first in the rewrite section…

    1
    2
    3
    4
    5
    6
    7
    
    <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>

    For Helicon Ape, add these lines to the .htaccess file in your wwwroot under the RewriteEngine On directive

    1
    2
    3
    
    RewriteEngine On
    RewriteCond %{HTTPS} !on
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

    Apache – .htaccess

    Add these lines to your site’s root .htaccess file directly under the RewriteEngine On directive

    1
    2
    3
    
    RewriteEngine On
    RewriteCond %{HTTPS} !on
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
    1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
    Loading...
  1. Hi,
    how can we set the https redirect on an aspnet core web application?
    I tried this in the Configure method during application startup:
    app.UseHsts();
    app.UseHttpsRedirection();

    But it does not work always. For example no redirect happens if I navigate in a private windows.

    Best,

    Antonio Valentini

    Comment by Antonio Valentini on September 9th, 2018 at 2:26 PM



  2. Give this article a read – https://docs.microsoft.com/en-us/aspnet/core/security/enforcing-ssl?view=aspnetcore-2.1&tabs=visual-studio

    Comment by Christopher York Staff Member on September 9th, 2018 at 4:28 PM



Allowed tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Uptime 100%

MoneyBack Gurantee

Why Choose Us