# Let's Encrypt SSL fails on redirected site

**URL:** <https://forum.virtualmin.com/t/lets-encrypt-ssl-fails-on-redirected-site/118709>\
**Category:** Help! (Home for newbies)\
**Created:** [January 17, 2023, 11:06pm UTC](https://forum.virtualmin.com/t/lets-encrypt-ssl-fails-on-redirected-site/118709 "2023-01-17T23:06:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![charlesworks](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/charlesworks/32/5685_2.png) [@charlesworks](https://forum.virtualmin.com/u/charlesworks)\
**Post date:** [January 17, 2023, 11:06pm UTC](https://forum.virtualmin.com/t/lets-encrypt-ssl-fails-on-redirected-site/118709/1 "2023-01-17T23:06:02Z")

</div>

| SYSTEM INFORMATION | |
| --- | --- |
| OS type and version | Debian 10 |
| Virtualmin version | 7.5 |

I set up a site to redirect its shorter domain name to another site using the full longer domain name. I set up Let’s Encrypt on it. I then set up an .htaccess file to redirect the site with the shorter name to the site with the longer name.

This works fine on my servers that use other control panels.

Let’s Encrypt failed to renew the certificate. The errors generated indicate that DNS was incorrect. It wasn’t. It appears that Let’s Encrypt in Virtualmin doesn’t “know” that it should ignore the .htaccess file in the case of writing the Let’s Encrypt as other control panels appear to.

Any suggestions on how to work around this?

Has this been reported as an issue? Can a fix be implemented?

Thanks for any help!

---

<div class="post-metadata">

**Author:** ![Joe](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/joe/32/9_2.png) [@Joe](https://forum.virtualmin.com/u/Joe)\
**Post date:** [January 17, 2023, 11:56pm UTC](https://forum.virtualmin.com/t/lets-encrypt-ssl-fails-on-redirected-site/118709/2 "2023-01-17T23:56:56Z")

</div>

You have to exclude the `.well-known` directory from any redirects, proxy rules, etc.

> [@charlesworks](#):
>
> It appears that Let’s Encrypt in Virtualmin doesn’t “know” that it should ignore the .htaccess file

That’s not how it works. Your webserver must serve the Let’s Encrypt validation key from the filesystem where the ACME client puts it. Virtualmin isn’t involved in that request/response and can’t be (Virtualmin isn’t the web server answering those requests).

With web validation, the Let’s Encrypt client (usually certbot, but Webmin has an embedded one, too, that is less capable, if you’re on a very old OS that can’t run certbot) makes a request to the LE servers, which respond with a validation key, which is then placed by the Let’s Encrypt client into the .well-known directory in the public\_html of the website. The LE validation system then requests that file, and if it finds it, it knows the requester of the cert owns the domain.

In short: Virtualmin can’t change that workflow. You have to allow `.well-known` to be served from the filesystem if you want a Let’s Encrypt certificate validated via web validation.

Edit: Also, when Virtualmin is responsible for the redirects or proxy rules, it will generally add the necessary exclusion for .well-known.

---

<div class="post-metadata">

**Author:** ![charlesworks](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/charlesworks/32/5685_2.png) [@charlesworks](https://forum.virtualmin.com/u/charlesworks)\
**Post date:** [January 18, 2023, 12:46am UTC](https://forum.virtualmin.com/t/lets-encrypt-ssl-fails-on-redirected-site/118709/3 "2023-01-18T00:46:01Z")

</div>

Thanks for this, Joe.

When you say “when Virtualmin is responsible for the redirects or proxy rules, it will generally add the necessary exclusion for .well-known” how do I make that happen?

I set the site up as a site of its own and manually added the .htaccess. Is there a better way to set the site up as a redirect so the .well-known access will be handled by Virtualmin properly? In other words, how do I make Virtualmin responsible for the redirects or proxy rules?

Thanks again,  
Charles

---

<div class="post-metadata">

**Author:** ![charlesworks](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/charlesworks/32/5685_2.png) [@charlesworks](https://forum.virtualmin.com/u/charlesworks)\
**Post date:** [January 18, 2023, 2:07am UTC](https://forum.virtualmin.com/t/lets-encrypt-ssl-fails-on-redirected-site/118709/4 "2023-01-18T02:07:43Z")

</div>

Hi again,

I figured it out after stumbling across:  
Server Configuration \> Website Redirects

After setting up the redirect, I was able to then navigate to  
Server Configuration \> SSL Certificate  
and set up Let’s Encrypt just fine.

Thanks again,  
Charles

---

<div class="post-metadata">

**Author:** ![system](https://cdn.forum.virtualmin.com/uploads/default/original/2X/c/cd96d761e326db4b2bef94886a639109bd7a8e76.svg) [@system](https://forum.virtualmin.com/u/system)\
**Post date:** [March 19, 2023, 2:08am UTC](https://forum.virtualmin.com/t/lets-encrypt-ssl-fails-on-redirected-site/118709/5 "2023-03-19T02:08:28Z")

</div>

Closed on March 19, 2023, 2:08am UTC

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
