Search

Language:  
Search for:

Available article translations:

How do I force all visitors of my website to use secure connection (HTTPS)?

Article ID: 112135, created on Aug 30, 2011, last review on Dec 1, 2015

APPLIES TO:
  • Plesk for Linux/Unix
  • Plesk for Windows

Question

How do I force all visitors of my website to use secure connection (HTTPS)?

Answer

Linux:

  1. Make sure that mod_rewrite Apache module is enabled:

    # httpd -t -D DUMP_MODULES | grep rewrite
    Syntax OK
     rewrite_module (shared)
    
  2. Create file .htaccess in document root of the domain and put following configuration inside:

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

or

Go to Plesk > Domains > example.com > Websites & Domains > Web Server Settings and add above configuration to Additional directives for HTTP. Refer this KB-article to find more information about configure redirects in Plesk

Windows:

Follow the steps from this article.

or

Create file web.config in document root of the domain and put following configuration inside:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="http to httpos" 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>

Search words:

force https

force secure connection

redirection from http to https

http to https

ssl




a914db3fdc7a53ddcfd1b2db8f5a1b9c 29d1e90fd304f01e6420fbe60f66f838 56797cefb1efc9130f7c48a7d1db0f0c 85a92ca67f2200d36506862eaa6ed6b8

FEEDBACK
Was this article helpful?
Tell us how we may improve it.
Yes No
 
 
 
 
 
 
Server Virtualization
- Odin Cloud Server
- Odin Containers for Windows 6.0
- Odin Virtuozzo Containers
Automation
- Odin Automation
- Odin Automation for Cloud Infrastructure
- Odin Business Automation Standard
- Odin Virtual Automation
- Odin Plesk Panel Suite
- Web Presence Builder
- Odin Plesk Automation
- Odin Small Business Panel
- Value-added Services for Hosters
- Odin Partner Storefront
Services & Resources
- Cloud Acceleration Services
- Professional Services
- Support Services
- Training & Certification