Skip to content

Commit fc747bb

Browse files
extremumratioLeoColomb
extremumratio
authored andcommitted
fix work forcing www/no-www with https
1 parent 4c13648 commit fc747bb

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/rewrites/rewrite_www.conf

+11-2
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,21 @@
1616
#
1717
# (!) NEVER USE BOTH RULES AT THE SAME TIME!
1818

19+
# (1) The two rules assume by default that both HTTP and HTTPS
20+
# environnements are available for redirection.
21+
# If your SSL certificate could not handle one of the domains
22+
# used during redirection, you should turn the condition on.
23+
#
24+
# https://github.com/h5bp/server-configs-apache/issues/52
25+
1926
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2027

2128
# Option 1: rewrite www.example.com → example.com
2229

2330
<IfModule mod_rewrite.c>
2431
RewriteEngine On
25-
RewriteCond %{HTTPS} !=on
32+
# (1)
33+
# RewriteCond %{HTTPS} !=on
2634
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
2735
RewriteRule ^ %{ENV:PROTO}://%1%{REQUEST_URI} [R=301,L]
2836
</IfModule>
@@ -36,7 +44,8 @@
3644

3745
# <IfModule mod_rewrite.c>
3846
# RewriteEngine On
39-
# RewriteCond %{HTTPS} !=on
47+
# # (1)
48+
# # RewriteCond %{HTTPS} !=on
4049
# RewriteCond %{HTTP_HOST} !^www\. [NC]
4150
# RewriteCond %{SERVER_ADDR} !=127.0.0.1
4251
# RewriteCond %{SERVER_ADDR} !=::1

0 commit comments

Comments
 (0)