404 challenge Ubuntu 18, Apache2

Try it this way:

  #skip challenge requests and
  <LocationMatch "^/(?!\.well-known)">
    #send all other requests to HTTPS
    RewriteEngine On
    RewriteCond %{HTTPS} !=on
    RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1
  </LocationMatch>

  DocumentRoot /var/lib/letsencrypt/http_challenges
1 Like