Whilst trying to install / renew a Let’s Encrypt certificate on a Drupal 7 site running on a Virtualmin server, you get the following message:
Requesting a certificate for yourdomain.com, www.yourdomain.com from Let's Encrypt .. .. request failed : Web-based validation failed : Failed to request certificate : www.yourdomain.com challenge did not pass: Invalid response from http://www.yourdomain.com/.well-known/acme-challenge/2NJm81yd8wwRTNlCHNESp27u9NNVr_sDXR2U0IsoltU [18.104.22.168]: "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<html><head>\n<title>403 Forbidden</title>\n</head><body>\n<h1>Forbidden</h1>\n<p" DNS-based validation failed : Failed to request certificate : www.yourdomain.com challenge did not pass: DNS problem: NXDOMAIN looking up TXT for _acme-challenge.www.yourdomain.com
Here are things you can check:
- Temporary rename the Drupal .htaccess file to something else and try again.
- If your domain is “yourdomain.co.za”, and these three items in Virtualmin also have a decimal in:
a. Administration username
b. Home directory
c. User name suffix and group
You might want to try and rename your domain to something else (temporary), and then make sure that when you rename it back all three the above items do not have a dot in their name when you rename back.
As from the article below which speaks about the Drupal 7 .htaccess file, their fix is to change the following:
To fix that is needed to replace this line in .htaccess:
RewriteRule "(^|/)." - [F] by
RewriteRule "(^|/).(?!well-known)" - [F]
This might however only be a temporary solution as Drupal may overwrite the .htaccess file.