Skip to content

Instantly share code, notes, and snippets.

@mmaridev
Created December 12, 2018 19:57
Show Gist options
  • Save mmaridev/ffdae7af63448f13c7492b5f4d638fbd to your computer and use it in GitHub Desktop.
Save mmaridev/ffdae7af63448f13c7492b5f4d638fbd to your computer and use it in GitHub Desktop.
Apache Rewrite redirection to https excluding let's encrypt folder
<VirtualHost *:80>
ServerName you.example.org
ServerAlias www.you.example.org
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error_you_sezf_it.log
CustomLog ${APACHE_LOG_DIR}/access_you_sezf_it.log combined
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/?(.well-known)/
RewriteRule ^(.*) https://%{HTTP_HOST}%{REQUEST_URI}
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment