We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ae91310 commit 2246ca3Copy full SHA for 2246ca3
1 file changed
resources/modules/Nginx/conf/snippets/force_non_www.conf
@@ -1,5 +1,23 @@
1
# Redirect www.example.com to example.com
2
3
-if ($host ~* ^www\.(.+)$) {
4
- return 301 $scheme://$1$request_uri;
+if ($http_host ~* '^www\.(.+)$') {
+ if ($http_x_forwarded_proto ~* '^https$') {
5
+ return 301 https://$1$request_uri;
6
+ }
7
}
8
+
9
10
+ if ($scheme = "https") {
11
+ if ($http_x_forwarded_proto = "") {
12
13
14
15
+}
16
17
18
+ if ($scheme != "https") {
19
+ if ($http_x_forwarded_proto !~* '^https$') {
20
+ return 301 http://$1$request_uri;
21
22
23
0 commit comments