I'm using Ubuntu 18.04 with Apache.
I have the following in /etc/apache2/sites-available/000-default.conf:
<VirtualHost *:80>
RewriteEngine On
RewriteCond %{SERVER_NAME} =www.example.com [OR]
RewriteCond %{SERVER_NAME} =example.com
RewriteRule ^ https://www.%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
I want to redirect all to https AND www.
These get all redirected to https://www.example.com:
https://www.example.com
http://example.com
http://www.example.com
This doesn't get redirected to https://www.example.com:
https://example.com
I also added the code with <VirtualHost *:443> but this doesn't help.
Why doesn't get https://example.com redirected to https://www.example.com?