• 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!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • 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.

Resolved Redirect non-www to www subdomain

imartin83

New Pleskian
Server operating system version
ubuntu 22.04
Plesk version and microupdate number
Plesk Obsidian Web Host Edition 18.0.47
Hello guys,
I little help will do great. :)
Issue:
blog.domain.com --> www.blog.domain.com= Google stays happy :)

- I have migrated a web with a subdomain www.blog.domain.com to plesk.
- Created an FTP folder for blog.domain.com (with no www).
- In DNS on Cloudflare pointed to it via records: A record "www.blog" to IP; A record "blog" to IP; CNAM "www" to @; wildcard * A record to @.
- In the database the home URL is set as https://blog.domain.com (used to be with "www", but now does not resolve if used "www")
- SSL certificate is installed via Let's encrypt in Plesk (Cloudflare Free does not support 3rd level subdomains like "www.blog")

Issue 1: Non-www subdomain is working OK. www.blog is not working ("Site can't provide secure connection - ERR_SSL_VERSION_OR_CIPHER_MISMATCH").
Issue 2: Redirection to WWW is not working, when editing .htaccess file of the subdomain. I cannot even do the vice versa, redirect the non-www to www.
Used redirection in subdomain folder:
RewriteCond %{HTTP_HOST} !^blog\.domain\.cz$ [NC]
RewriteRule ^(.*)$ https://blog.domain.cz/$1 [R=301,L]

The subdomain is under the main domain, so it has no option to set preferred display with or without "www" in plesk. Kindda confused with all the redirections, SSLs and crazy things. Why make it simple, if it can be complex.

Thanks for any idea.
Regards
Martin
 
SOLVED!

Ok, after a bit of digging.
This was a TLS version option in Plesk it seems. In Domains > domain.com > SSL/TLS > TLS Versions and applied preset should be set to Modern (default is intermediate). If TLS is managed in Cloudflare, then I think it should be only with a purchased certificate. So, this concerns only free Let's Encrypt in Plesk.

Also, subdomain redirect was changed to:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule (.*) https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>

This should be placed in .htaccess of the subdomain, at the top, before anything else. This is only if in Cloudflare Proxy is turned OFF for the DNS record www.subdomain. i think it can mess things up, not sure though.

If proxy is ON, another redirection can be set:

<IfModule mod_rewrite.c>
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule (.*) https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>

I just did not have time and the nerves to try the proxy setup if it is OK with Cloudflare.
Also, in the database I set back the home URL to be with "www" and "https", as the redirect will not work otherwise.

Hope it helps for those lost souls out there. :)
Martin
 
Back
Top