Question
How do I prevent AutoSSL from following redirects in Apache includes? This article would be relevant if you are using one of the below methods to modify the Apache configuration and AutoSSL is following a redirect configured in the include:
How to use Apache includes to add configuration directives to a specific domain's virtualhost
Where would I add customizations to Apache?
Answer
To accomplish this, you would edit your Apache includes file to contain the following entries at the top of the file:
<IfModule mod_rewrite.c>
RewriteEngine On
# Global DCV Exclude - Rewrites
RewriteCond %{REQUEST_URI} ^/\.well-known/acme-challenge/.+$ [OR]
RewriteCond %{REQUEST_URI} ^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$ [OR]
RewriteCond %{REQUEST_URI} ^/\.well-known/pki-validation/(?:\ Ballot169)? [OR]
RewriteCond %{REQUEST_URI} ^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$ [OR]
RewriteCond %{REQUEST_URI} ^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Sectigo\ DCV)?$
# Exclude proxy subdomains as we need rewrites to capture the DCV requests
RewriteCond %{HTTP_HOST} !^(?:autoconfig|autodiscover|cpanel|cpcalendars|cpcontacts|webdisk|webmail|whm)\.
RewriteRule ^ - [END]
</IfModule>
At the time of writing this article, these are the same directives used in the httpd.conf for the global DCV exclude to allow AutoSSL to disregard .htaccess directives.