Using SNI, there are multiple domains with their own SSL certificates (LetsEncrypt) on one IP address. For one of the primary domains, let's just say https://thedomain.tld, visiting https://www.thedomain.tld results in a browser error (mis-matching SSL certificate) instead of either serving content for www.thedomain.tld or redirecting. I have tried it a variety of ways. An example:
<IfModule mod_ssl.c>
<VirtualHost 0.0.0.1:443>
ServerName domain.tld
ServerAlias www.domain.tld
DocumentRoot /var/www/domain.tld/
...
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/domain.tld/cert.pem
...
<Directory /var/www/domain.tld>
Options -ExecCGI -Indexes -Includes +FollowSymLinks
AllowOverride FileInfo AuthConfig
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^/(.*)$ https://%1/$1 [R=301,L]
...
Version: Apache 2.4.18
Side note: One one server, this works fine (Dedicated Ubuntu 16.04). On the other (Amazon Ubuntu 16.04), its ability to redirect or reference or whatever the www- and without is nonexistent.