Using certbot 0.31.0 on Ubuntu 18.04.3
I’ve noticed that when I create a new certificate with the Apache plugin, certbot puts the following stanza in the port 80 config if I choose to automatically re-direct to port 443:
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.mydomain.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
However, if I later add another host to the certificate using the following command:
certbot certonly --cert-name mydomain.com -d www.mydomain.com,www.differentname.com
the Apache redirect for www.differentname.com doesn’t work because the original host name(s) are explicitly given in the RewriteCond.
What would happen if certbot instead wrote it out as this line?
RewriteCond %{SERVER_PORT} !^443$
That way, any and all subsequent host added to the cert would redirect. Or is there some problem with that?