Redirection not working anymore and odd behavior


#1

I just installed let’s encrypt in my blog that runs on apache. I had before a redirection from http:// www. miguelgfierro.com to http:// miguelgfierro.com. I used Redirect to do it and it worked well. However, when I installed let’s encrypt now suddenly I have the both links redirect to https:// www. miguelgfierro.com and I don’t know why.

My current configuration is the following:

<VirtualHost *:443>        
ServerName www.miguelgfierro.com
ServerAlias miguelgfierro.com
DocumentRoot /var/www/sciblog 
SSLEngine On
SSLCertificateFile /etc/letsencrypt/live/www.miguelgfierro.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www.miguelgfierro.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/www.miguelgfierro.com/chain.pem
</VirtualHost>

I don’t have a configuration with VirtualHost: *80 right now because it’s not affecting the server at all, so I erased it.

I would like to redirect everything (http://, http:// www, https:// and https:// www.) to https://miguelgfierro.com. I tried to use Rewrite and Redirect but none of them work. Any help is appreciated


Standard force http to https isn't working
#2

Hello @hoaphumanoid,

Hope this helps:

<VirtualHost *:80>
ServerName miguelgfierro.com
ServerAlias www.miguelgfierro.com
Redirect permanent / https://miguelgfierro.com/
</VirtualHost>

<VirtualHost *:443>
ServerName www.miguelgfierro.com
Redirect permanent / https://miguelgfierro.com/
SSLEngine On
SSLCertificateFile /etc/letsencrypt/live/www.miguelgfierro.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www.miguelgfierro.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/www.miguelgfierro.com/chain.pem
</VirtualHost>

<VirtualHost *:443>
ServerName miguelgfierro.com
DocumentRoot /var/www/sciblog
SSLEngine On
SSLCertificateFile /etc/letsencrypt/live/www.miguelgfierro.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www.miguelgfierro.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/www.miguelgfierro.com/chain.pem
</VirtualHost>

Cheers,
sahsanu


#3

Thank you friend, it worked perfectly!