Clicky

How to Redirect to HTTPS - I'm Aware I'm a Wolf

How to Redirect to HTTPS

First, determine the type of web hosting you have (if you don’t already know).

For Linux web hosting, .htaccess pages are used to automatically redirect visitors to the HTTPS version of your website.

To utilize this HTTPS redirection feature, update your .htaccess file to include the following (alternatively, if you don’t already have an .htaccess file, create a new file named .htaccess in your root directory containing the following code):

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Windows-based files use web.config files to handle HTTPS redirection.
Similarly to the Linux version, to utilize the HTTPS redirection in your web.config file, copy the following code into your web.config file (or create a new file named web.config, containing the following code):
<configuration>
<system.webServer>
<rewrite>
    <rules>
    <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>   
    </rules>
</rewrite>
</system.webServer>
</configuration>

 

4 thoughts on “How to Redirect to HTTPS

  1. Blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah

    Blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll Up