Plesk

 How to enable redirection from HTTP to HTTPS for a domain in Plesk

Question

How to make a website hosted in Plesk use a secure connection over HTTPS permanently?

Answer

Before enabling permanent HTTPS redirection for a domain, make sure that the website is accessible over HTTPS:

 

  1. Log in to Plesk.

  2. Go to Domains > example.com > Hosting Settings.

  3. Enable the setting Permanent SEO-safe 301 redirect from HTTP to HTTPS and select your certificate from the drop-down menu. Apply the changes.

    Note: If the setting Permanent SEO-safe 301 redirect from HTTP to HTTPS is grayed out, please contact your service provider for assistance with permanent HTTPS redirection.

 

Alternative solutions for Linux

 

Enabling HTTPS redirection using additional Apache and nginx directives in Plesk (For Linux)

 

  1. Log in to Plesk.

  2. Go to Domains > example.com > Apache & nginx Settings.

  3. Copy the following directives to the Additional directives for HTTP field:

    Note: If you are a domain owner and Apache & nginx Settings is not available for you, please contact your service provider for assistance with permanent HTTPS redirection.

    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{HTTPS} !=on
    RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R,QSA]
    </IfModule>

  4. Copy the following directives to the Additional nginx directives field, if nginx is used:

    if ($ssl_protocol = "") {
    rewrite ^/(.*) https://$server_name/$1 permanent;
    }

 

Enabling HTTPS redirection via the .htaccess file (For Linux)

 

Note: This solution is applicable only if a website is processed by Apache.

  1. Log in to Plesk.

  2. Go to Domains > example.com > File Manager.

  3. Open the .htaccess file, if available, or create a new one: click > Create File > type .htaccess in the File Name field > click OK. Once created, click on the file and paste the following content:

    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{HTTPS} !=on
    RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R,QSA]
    </IfModule>

  4. Click OK.

 

 

Alternative solutions for Windows Server

 

Enabling HTTPS redirection via domain's web.config file (For Windows Server)

 

  1. Log in to Plesk.

  2. Go to Domains > example.com > File Manager and open the web.config file.

  3. Paste the following content right before </system.webServer>:

    Note: If the <rewrite>/<rules> sections already present in the web.config file, put the content below without tags <rewrite><rules>... </rules></rewrite> inside existing <rules> section.

    <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>

    Click on the picture to enlarge
    Code Editor

 

Enabling HTTPS redirection in IIS Manager (For Windows Server)

 

  1. Connect to a Plesk server via RDP.

  2. Start Internet Information Service (IIS…

Exit mobile version