LEFT | RIGHT |
1 server | 1 server |
2 { | 2 { |
3 listen 80 default_server; | 3 listen 80 default_server; |
4 listen [::]:80 default_server; | 4 listen [::]:80 default_server; |
5 server_name '<%= vhost %>'; | 5 server_name '<%= vhost %>'; |
6 | 6 |
7 location / | 7 location / |
8 { | 8 { |
9 rewrite (.*) https://<%= vhost %>$1 permanent; | 9 rewrite (.*) https://<%= vhost %>$1 permanent; |
10 } | 10 } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 if (-d $request_filename) | 65 if (-d $request_filename) |
66 { | 66 { |
67 break; | 67 break; |
68 } | 68 } |
69 | 69 |
70 # Redirect canonical URLs to language-specific versions | 70 # Redirect canonical URLs to language-specific versions |
71 | 71 |
72 set $canonical $uri; | 72 set $canonical $uri; |
73 if ($canonical ~ ^(.*?)\?) | 73 if ($canonical ~ ^(.*?)\?) |
74 { | 74 { |
75 | 75 set $canonical $1; |
76 } | 76 } |
77 | 77 |
78 if (-f $document_root/$preferredLang$canonical) | 78 if (-f $document_root/$preferredLang$canonical) |
79 { | 79 { |
80 rewrite ^ /$preferredLang$canonical last; | 80 rewrite ^ /$preferredLang$canonical last; |
81 } | 81 } |
82 if (-f $document_root/en$canonical) | 82 if (-f $document_root/en$canonical) |
83 { | 83 { |
84 rewrite ^ /en$canonical last; | 84 rewrite ^ /en$canonical last; |
85 } | 85 } |
86 } | 86 } |
LEFT | RIGHT |