404 challenge Ubuntu 18, Apache2

OR
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>

  <Location /.well-known/acme-challenge/>
   DocumentRoot /var/lib/letsencrypt/http_challenges
  </Location>
1 Like