Skip to content

Commit

Permalink
Add rewrite condition.
Browse files Browse the repository at this point in the history
	modified:   patches/etc.apache2.sites-available.000-default.conf.patch
  • Loading branch information
RainerEmrich committed May 27, 2018
1 parent 621cf04 commit 9443ee2
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions patches/etc.apache2.sites-available.000-default.conf.patch
Original file line number Diff line number Diff line change
@@ -1,12 +1,30 @@
--- 000-default.conf.orig 2016-03-19 09:48:35.000000000 +0000
+++ 000-default.conf 2018-01-16 09:59:59.875227151 +0000
@@ -26,6 +26,10 @@
--- 000-default.conf.orig 2018-05-27 10:38:20.168898686 +0000
+++ 000-default.conf 2018-05-27 10:40:02.113596043 +0000
@@ -11,6 +11,16 @@
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html

+ # Directory for letsencrypt webroot challenge.
+
+ Alias /.well-known/acme-challenge/ "/var/www/html/.well-known/acme-challenge/"
+
+ <Directory "/var/www/html/.well-known/acme-challenge/">
+ Options None
+ AllowOverride None
+ Require all granted
+ </Directory>
+
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
@@ -26,6 +36,11 @@
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
+
+ # Redirect all requests to https.
+ RewriteEngine on
+ RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge/*
+ RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
</VirtualHost>

Expand Down

0 comments on commit 9443ee2

Please sign in to comment.