WordPress and Let's Encrypt - Using HTTPS takes me to an HTML index page

July 23, 2017 176 views
Let's Encrypt WordPress Apache Ubuntu 16.04

I recently got my site up and running following these tutorials:
How to Secure Apache with Let's Encrypt
How to Install WordPress

My problem is that despite refusing standard HTTP connections, typing my domain simply takes me to my WordPress site. If I manually type "https://" before my domain, I'm taken to my HTML index/test page. What's happening here?

1 Answer

Hi @tylerferguson

Can you post your VirtualHost configurations for both HTTP (port 80) and HTTPS (port 443)?

  • @hansen
    port 80:

    <VirtualHost *:80>
    ServerAdmin admin@domain.org
    ServerName domain.org
    ServerAlias www.domain.org
    DocumentRoot /var/www/domain.org/public_html
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    RewriteEngine on
    RewriteCond %{SERVER_NAME} =domain.org [OR]
    RewriteCond %{SERVER_NAME} =www.domain.org
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
    </VirtualHost>
    

    port 443:

    <IfModule mod_ssl.c>
    <VirtualHost *:443>
    ServerAdmin admin@domain.org
    ServerName domain.org
    ServerAlias www.domain.org
    DocumentRoot /var/www/domain.org/public_html
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    SSLCertificateFile /etc/letsencrypt/live/domain.org/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/domain.org/privkey.pem
    Include /etc/letsencrypt/options-ssl-apache.conf
    </VirtualHost>
    </IfModule>
    

    Now that I look at it, I think I have to set the DocumentRoot to my WordPress directory, correct?

    • @tylerferguson

      Correct, the DocumentRoot should be your web root, so in your case it's the WordPress directory.

      And you can change your <VirtualHost *:80> block to this:

      <VirtualHost *:80>
      ServerName domain.org
      ServerAlias www.domain.org
      Redirect permanent / https://www.domain.org/
      </VirtualHost>
      
Have another answer? Share your knowledge.