Skip to content

Exception RewriteCond in .htaccess to Allow Cert Validation

tomkiser edited this page Feb 10, 2017 · 2 revisions

Webfaction suggests a way to forward HTTP to HTTPS sites using .htaccess, but some adjustment is needed to allow the certificate validation step to occur, in which, the script accesses a URL like to prove the site is owned by you.

Add a RewriteCond to your .htaccess to allow the script to work:

 RewriteEngine On
 RewriteCond %{REQUEST_URI} !\.well-known/acme-challenge
 RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
 RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
You can’t perform that action at this time.