I have a small issue I cannot solve. I run Apache on Ubuntu 16.04 and after installing a Let's encrypt cert, all works except for this...
When I type mydomain.com, it goes automatically to https://mydomain.com
When I type www.mydomain.com, it goes automatically to https://mydomain.com
When I type mydomain.com, it goes automatically to https://mydomain.com
When I type http://mydomain.com, it goes automatically to https://mydomain.com
But when I type http://www.mydomain.com, it stays in insecure http://www.mydomain.com
Here are the conf files...
nuc@nuc:~$ cat /etc/apache2/sites-available/000-default.conf
<VirtualHost *:80>
ServerName mydomain.com
ServerAlias www.mydomain.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =mydomain.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
and...
nuc@nuc:~$ cat /etc/apache2/sites-available/000-default-le-ssl.conf
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName mydomain.com
ServerAlias www.mydomain.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/mydomain.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/mydomain.com/privkey.pem
</VirtualHost>
</IfModule>
Any help would be greatly appreciated... :-)