With increasing role of HTTPS websites (Google pushing everybody to run only HTTPS websites considering regular HTTP as insecure) the service provided by Let’s encrypt becomes critically important. But there is a catch – once you get the certificate and redirect your site to HTTPS using .htaccess you will get a problem renewing certificate because 301 redirect breaks the challenge verification and the command
1 |
certbot-auto renew |
gives an error about authorization problem.
Here is the correction to the .htaccess file that allows to avoid this problem.
- Here is HTTPS redirection part of your .htaccess file before modification
1234# Redirection vers HTTPSRewriteCond %{SERVER_PORT} ^80$ [OR]RewriteCond %{HTTPS} =offRewriteRule ^(.*)$ https://domain.com$1 [R=301,L]
- This is the same part after adjustment
1234# Redirection vers HTTPSRewriteCond %{SERVER_PORT} ^80$ [OR]RewriteCond %{HTTPS} =offRewriteRule ^(?!/\.well-known(?:$|/)).* https://domain.com$0 [R=301,L]
0 Comments.