<VirtualHost *:80>
ˆˆˆ A VirtualHost on port 80 should always be the plain, clear text, http host. You can never have both plain http AND https on the same port.
That means that the configuration lines below can NEVER apply and should be omitted:
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,END]
This Redirect
directive:
Redirect "/" "https://www.temp.com"
is the simple and recommended version of the mod-rewrite code below that is functionally equivalent:
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,END]
they both redirect from plain http to https. You don't need both. I recommend deleting the mod_rewrite code.
You certainly don't need to repeat that redirect to https functionality a third time in your .htaccess
file.
There should be a code block for a HTTPS VirtualHost that looks something like:
<VirtualHost *:443>
ServerName www.temp.com
ServerAlias temp.com
DocumentRoot /var/www/temp.com/
SSLEngine on
SSLProtocol All -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
SSLCertificateFile /etc/letsencrypt/live/.../cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/..../privkey.pem
SSLCACertificateFile /etc/letsencrypt/live/.../chain.pem
</VirtualHost>