• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

cannot redirect https://example.com to https://www.example.com

Gauthier

New Pleskian
This is on:

OS: ‪CentOS Linux 7.2.1511 (Core)‬
Plesk version: 12.5.30 Update #27

My ssl certificate is for www.example.com

Using the "Additional directives for HTTP " text area in plesk, I can redirect http://example.com and http://www.example.com, both to httpS://www.example.com.

I also want to redirect https://example.com to https://www.example.com

But the "Additional directives for HTTPS" text area is apparently not working. I fill it with:

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI}

Checked it was actually wrote to the vhost_ssl.conf, and restarted apache.

As far as I know this should be rewriting https://example.com to https://www.example.com but it just does nothing.

Actually, I found out that WHATEVER I put in "Additional directives for HTTPS" will only be executed if:

1.- the connection is on https protocol (ok)
2.- the url starts with "www." (not ok, I precisely need to add www. if missing)

Please help
 
Hi Gauthier,

Are you running Nginx too?
If so try adding...

Additional nginx directives

Code:
if ($host ~* ^domain.tld$) {
    rewrite ^(.*)$ https://www.domain.tld$1 permanent;
}

Let me know how you get on.
Regards

Lloyd
 
Thanks for quick reply.

nginx is installed. nginx -v returns nginx/1.9.4

In plesk, I removed the apache directives and fill the "Additional nginx directives" with:

if ($host ~* ^example.com$) {
rewrite ^(.*)$ https://www.example.com$1 permanent;
}

I ran "nginx -s reload" and restart apache. Clear cache of the browser.

https://example.com is still not redirected.
 
I also found out the following:

Add an ssl exception on firefox to access https://example.com and got a 403 error.

Forbidden
You don't have permission to access / on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

But the https://www.example.com works fine.

Maybe this error can put us on the way to the misconfiguration ?
 
Back
Top