Not a clean Let'sEncrypt SSL install. Website's internal links won't https automatically.

August 30, 2018 1.1k views
Apache Let's Encrypt Ubuntu 16.04

Did a Wordpress one-click-install and migrated my website. After everything was setup I tried installing Let's encrypt SSL and faced few interruptions like console freezing up, python-certbot-apache not found, multiple v-host issue etc. I managed to install the SSL for both domain.com and www.domain.com and the SSL labs test for both verify that the SSL certificates are working. When I enter domain.com and press enter, it automatically changes to https://www.domain.com, all good. Certbot renewal dry run works fine too.

Now here is the problem, all the internal links in the page pointing to www.domain.com still stay http and wont automatically change to https. I can force https through wordpress plugins but I am not sure if this is the right way. Neither do I know if the SSL certificate for www.domain.com has been installed correctly. How do i fix this?

This is my default.conf file if needed

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html

        <Directory /var/www/html/>
            Options FollowSymLinks
            AllowOverride All
            Require all granted
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =domain.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
2 Answers

And this is my 000-default-le-ssl.conf file

IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html

    <Directory /var/www/html/>
        Options FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
ServerName domain.com
Include /etc/letsencrypt/options-ssl-apache.conf
ServerAlias www.domain.com
SSLCertificateFile /etc/letsencrypt/live/domain.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/domain.com/privkey.pem
</VirtualHost>
</IfModule>
Have another answer? Share your knowledge.