Applicable to:
- Plesk for Linux
- Plesk for Windows
Question
How to switch on redirection from HTTP to HTTPs for a domain on Plesk server?
Plesk Onyx
Plesk 12.5 and lower for Linux
Plesk 12.5 and lower for Windows
Answer
-
In Plesk navigate to Domains > example.com > Hosting Settings.
-
Issue a certificate for domain as described in Plesk guide.
-
Enable SSL/TLS support, Permanent SEO-safe 301 redirect from HTTP to HTTPS and select the needed certificate under Security section:
Note: If the domain is on WordPress, it's also possible to do that using WordPress admin panel in Settings > General and change WordPress Address (URL) and Site Address (URL) to
https://example.com
.
Plesk 12.5 and below
-
Make sure that rewrite module is enabled in Tools & Settings > Apache Web Server.
-
Open Domains > example.com > Apache & nginx Settings and paste following direcctives to Additional Apache directives > Additional directives for HTTP:
CONFIG_TEXT: <IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R,QSA]
</IfModule> -
Add the following directives into Additional nginx directives (if this field exists):
CONFIG_TEXT: if ($ssl_protocol = "") {
rewrite ^/(.*) https://$server_name/$1 permanent;
}
Note: This configuration only works on IIS 7 or newer and requires IIS Rewrite module being installed. IIS Rewrite can be downloaded from official IIS website.
Comments
2 comments
What if someone wants to disable HTTP access completely, rather than redirecting?
In other words, http://www.example.com should be unavailable, while https://www.example.com should.
@Marco, this is a custom scenario that is not covered by this article. Plesk does not provide such possibility however, the instruction can be found somewhere in google, I guess.
Please sign in to leave a comment.