Been banging my head on this one for a while, for some reason Apache refuses to properly implement https redirect. I have tried it using a permanent redirect as well as a mod rewrite and everything in between. Currently I only have one virtual hosts file as I was trying to remove any unnecessary convolution. I checked the status of the Apache config and it shows the virtual hosts file in question being used.
I am trying to renew a lets encrypt cert, and I cant renew since it accesses the site via http. Whenever I try to access my site via http it gives me a 400 error stating that it cant deliver an http site using port 443. So basically Apache is redirecting http port 80 traffic to port 443, but it will not redirect http to https no matter what I try.
ServerName mysite.net
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(/(.*))?$ https://%{HTTP_HOST}/$1 [R=301,L]
ServerName mysite.net
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(/(.*))?$ https://%{HTTP_HOST}/$1 [R=301,L]
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/
SSLEngine on
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLCertificateFile /etc/letsencrypt/live/mysite.net/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/mysite.net/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
No comments:
Post a Comment