Force SSL/HTTPS connection (Plesk)

If you wish to use HTTPS instead of HTTP for your site, you will need to ensure a SSL certificate is installed in the control panel.

If you do not have a SSL certificate installed, you can consider to either purchase a SSL from APC or Install it using Let’s Encrypt in your control panel.


Once the SSL certificate has been installed, you will need to add the following code in the web.config file.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
    <rewrite>
        <rules>
                <rule name="http to https" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions>
                        <add input="{HTTPS}" pattern="^OFF$" />
                    </conditions>
                    <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Temporary" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>


If you are not sure on how to add the above code to your web.config file, kindly follow the steps below:


  1. Visit the site you intend to add the code to ensure the site is currently working with no issue.
  2. Login to your control panel.
  3. Click on “File Manager”.

ForceSSLPlesk1.png

 

Locate “web.config” file and on the right there is a box, click on it and select “Download” to download the current working web.config file to your local machine. When prompt, select a destination where you can locate the file in the event you need to retrieve the original code.


ForceSSLPlesk2.png

Once you have download the working web.config file, click on “web.config” in the file manager.


ForceSSLPlesk3.png


Select “Edit in Code Editor”


ForceSSLPlesk4.png


If your web.config has an existing code, you will may need to check with your developer if there is any issue if the code is replaced. If there is no issue, you will need to add the above code to the file and when you are done, click on “OK”. Kindly use another browser and visit the site. If there is no error the site will show up with HTTPS.


ForceSSLcPanel7.png

However, if there are error shown on the page, you may revert to the working site condition by copy and paste the code from the web.config file you downloaded earlier.

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.