Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 expires 1d; | 1 expires 1d; |
2 | 2 |
3 root /var/www/<%= vhost %>; | 3 root /var/www/<%= vhost %>; |
4 index index; | 4 index index; |
5 default_type text/html; | 5 default_type text/html; |
6 charset utf-8; | 6 charset utf-8; |
7 | 7 |
8 set $index_page "index"; | 8 set $index_page "index"; |
9 | 9 |
10 <% if @custom_config %> | 10 <% if @custom_config %> |
(...skipping 10 matching lines...) Expand all Loading... | |
21 { | 21 { |
22 set $preferredLang $1; | 22 set $preferredLang $1; |
23 } | 23 } |
24 if ($http_accept_language ~ ^\w\w-(\w\w)\b) | 24 if ($http_accept_language ~ ^\w\w-(\w\w)\b) |
25 { | 25 { |
26 set $preferredRegion $1; | 26 set $preferredRegion $1; |
27 } | 27 } |
28 | 28 |
29 # Redirect canonical URLs to language-specific versions | 29 # Redirect canonical URLs to language-specific versions |
30 | 30 |
31 if (-f "$document_root/${preferredLang}_$preferredRegion$uri") | 31 if (-e "$document_root/${preferredLang}_$preferredRegion$uri") |
32 { | 32 { |
33 rewrite ^(.*) /${preferredLang}_$preferredRegion$1 last; | 33 rewrite ^(.*) /${preferredLang}_$preferredRegion$1 last; |
34 } | 34 } |
35 if (-f "$document_root/$preferredLang$uri") | 35 if (-e "$document_root/$preferredLang$uri") |
36 { | 36 { |
37 rewrite ^(.*) /$preferredLang$1 last; | 37 rewrite ^(.*) /$preferredLang$1 last; |
38 } | 38 } |
39 if (-f "$document_root/en$uri/$index_page") | 39 if (-e "$document_root/en$uri") |
40 { | |
41 rewrite ^(.*) /en$1 last; | |
Wladimir Palant
2015/05/08 21:06:05
So people will always be redirected to the English
kzar
2015/05/08 22:01:42
Shucks, good point. Done.
| |
42 } | |
43 if (-f "$document_root/en$uri") | |
44 { | 40 { |
45 rewrite ^(.*) /en$1 last; | 41 rewrite ^(.*) /en$1 last; |
46 } | 42 } |
47 | 43 |
48 # Redirect server/language root | 44 # Redirect server/language root |
49 | 45 |
50 rewrite ^/$ /$index_page last; | 46 rewrite ^/$ /$index_page last; |
51 rewrite ^/(\w\w(_\w\w)?)$ /$1/ permanent; | 47 rewrite ^/(\w\w(_\w\w)?)$ /$1/ permanent; |
52 rewrite ^/(\w\w(_\w\w)?)/$ /$1/$index_page last; | 48 rewrite ^/(\w\w(_\w\w)?)/$ /$1/$index_page last; |
53 } | 49 } |
54 | 50 |
55 <% if @multiplexer_locations %> | 51 <% if @multiplexer_locations %> |
56 <% @multiplexer_locations.each do |location| %> | 52 <% @multiplexer_locations.each do |location| %> |
57 location <%= location %> | 53 location <%= location %> |
58 { | 54 { |
59 fastcgi_pass unix:/tmp/multiplexer-fastcgi.sock; | 55 fastcgi_pass unix:/tmp/multiplexer-fastcgi.sock; |
60 include /etc/nginx/fastcgi_params; | 56 include /etc/nginx/fastcgi_params; |
61 } | 57 } |
62 <% end %> | 58 <% end %> |
63 <% end %> | 59 <% end %> |
LEFT | RIGHT |