[SOLVED] Let's Encrypt and .htaccess

Hi Markus,

I was desperate to find a solution…

I must admit that you are not among the greatest anymore, you are THE greatest!

Your suggestion to use config.file is THE SOLUTION.

Original file: /etc/httpd/conf.d/letsencrypt.conf

Alias "/.well-known/acme-challenge/" "/var/www/html/.well-known/acme-challenge/"
<Directory "/var/www/html/.well-known/acme-challenge/">

    Require all granted
    Options -Indexes -FollowSymLinks
    AllowOverride None

</ Directory>

Changed to:

Alias "/.well-known/acme-challenge/" "/var/www/html/.well-known/acme-challenge/"
<Directory "/var/www/html/.well-known/acme-challenge/">

   Require all granted
   Options -Indexes +FollowSymLinks
   AllowOverride All

</ Directory>
  • I created an index.html in /var/www/html/.well-known displaying “Hello from .well-known!”
  • I created an index.html in /var/www/html/.well-known/acme-challenge displaying “Hello from acme-challenge!”

So to make sure that those directives will always be taken care off, even if Let’s Encrypt is updated:

  • I put back the original /etc/httpd/conf.d/letsencrypt.conf.
  • I created the file: /etc/httpd/conf.d/z_well-known.conf with the above modified content
  • Restarted the daemon: systemctl restart httpd
  • With the browser, I went to https://www.FQDN/.well-known and the right file is displayed.
  • With the browser, I went to https://www.FQDN/.well-known/acme-challenge and the right file is displayed.

I added imap.FQDN to the domains.
Requested a certificate.
Total Vicory :tada:

Now with your great suggestion, I will look at config file very closely to understand exactly what I can do with them. They can replace all .htaccess files… https://dev-notes.eu/2017/01/apache-directives-in-config-vs-htaccess/
Also: http://httpd.apache.org/docs/current/howto/htaccess.html#page-header

Again, thank you so much Markus for you support!

Michel-André

PS: There were typo errors: no backquote [`] are needed in the file.:blush:

1 Like