Knowledgebase: SSL Certificate
Force SSL/HTTPS connection (Plesk)
Posted by Simon  , Last modified by Jackson   on 23 June 2018 12:30 PM

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:

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

 

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



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

-    Select “Edit in Code Editor”

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

-    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

(3 vote(s))
Helpful
Not helpful

Copyright © APC Hosting Pte Ltd. All Rights Reserved.