WordPress Woocommerce site: Force SSL on Account page causes Internal Server Error

Solution:

Well, I changed a three things at once and I haven’t been able to isolate which one solved the problem so I’ll list all of them just in case someone else has the same situation.

First, I realized that in my SSL virtual host (/etc/apache2/sites-available/default-ssl.conf), my ServerName was set to the domain that will eventually be the domain instead of the IP address that I am currently using. This was definitely part of the problem but not the whole problem.

Second, I moved my whole site out of the subdirectory and into the root – I’m sure that isn’t necessary but I think it removed one possible source of confusion/issues.

Third, I implemented a fix that I found in some blog or article (that I cannot locate now for the life of me). The fix is in the virtual host that I mentioned above and looks like this (I removed comments and non-pertinent SSL sections at the end):

<IfModule mod_ssl.c>
        <VirtualHost _default_:443>
                ServerAdmin email@domain.com
                ServerName 45.55.XXX.XXX
                DocumentRoot /var/www/

                <Directory /var/www/>
                        Options Indexes FollowSymLinks MultiViews
                        AllowOverride All
                        Order allow,deny
                        allow from all
                        <IfModule mod_rewrite.c>
                                RewriteEngine On
                                RewriteBase /
                                RewriteRule ^index\.php$ - [L]
                                RewriteCond %{REQUEST_FILENAME} !-f
                                RewriteCond %{REQUEST_FILENAME} !-d
                                RewriteRule . /index.php [L]
                        </IfModule>
                </Directory>
                ErrorLog ${APACHE_LOG_DIR}/error.log
                CustomLog ${APACHE_LOG_DIR}/access.log combined
                SSLEngine on
                SSLCertificateFile      /etc/apache2/ssl/domain.com.crt
                SSLCertificateKeyFile /etc/apache2/ssl/domain.com.key
                SSLCertificateChainFile /etc/apache2/ssl/intermediate.crt

                [ ** The rest of the default ssl virtual host stuff ** ]

        </VirtualHost>
</IfModule>

Make sure the ServerName and DocumentRoot are right. I think this is where the subdirectory was causing problems but, again, I’m not 100% sure. If I can find the source of that code, I’ll come back and add a credit.