ssl – “Invalid Host Header” error on Apache2

I just used Certbot to install an SSL certificate on my web server. I can now access my website at https://example.com. However, simply typing example.com into the address bar takes me to the unsecured (http) version of the site, where it simply says “Invalid host header” and nothing else.

Certbot added the following rewrite rules:

RewriteEngine On
RewriteCond %{SERVER_NAME} =www.example.com (OR)
RewriteCond %{SERVER_NAME} =example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} (END,NE,R=permanent)

Any help would be much appreciated.