| OLD | NEW |
| 1 root /var/www/<%= @vhost %>; | 1 root /var/www/<%= @vhost %>; |
| 2 index index; | 2 index index; |
| 3 default_type text/html; | 3 default_type text/html; |
| 4 charset utf-8; | 4 charset utf-8; |
| 5 | 5 |
| 6 set $index_page "index"; | 6 set $index_page "index"; |
| 7 | 7 |
| 8 <% if @custom_config %> | 8 <% if @custom_config %> |
| 9 <%= @custom_config %> | 9 <%= @custom_config %> |
| 10 <% end %> | 10 <% end %> |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 rewrite ^(.*) /${preferredLang}_$preferredRegion$1 last; | 45 rewrite ^(.*) /${preferredLang}_$preferredRegion$1 last; |
| 46 } | 46 } |
| 47 if (-e "$document_root/$preferredLang$uri") | 47 if (-e "$document_root/$preferredLang$uri") |
| 48 { | 48 { |
| 49 rewrite ^(.*) /$preferredLang$1 last; | 49 rewrite ^(.*) /$preferredLang$1 last; |
| 50 } | 50 } |
| 51 if (-e "$document_root/en$uri") | 51 if (-e "$document_root/en$uri") |
| 52 { | 52 { |
| 53 rewrite ^(.*) /en$1 last; | 53 rewrite ^(.*) /en$1 last; |
| 54 } | 54 } |
| 55 } |
| 55 | 56 |
| 57 # Redirect language URIs if no translations are found for the requested page |
| 58 |
| 59 location ~ ^/([a-z][a-z]\_[A-Z][A-Z])(/.+) |
| 60 { |
| 61 if (!-e "$document_root$uri") |
| 62 { |
| 63 # if there is no language+region translation, try parent language URI |
| 64 # example /es_MX/page -> /es/page |
| 65 rewrite ^/([a-z][a-z])\_([A-Z][A-Z])(/.+) /$1$3 redirect; |
| 66 } |
| 67 } |
| 68 |
| 69 location ~ ^/([a-z][a-z])(/.+) |
| 70 { |
| 71 if (!-e "$document_root$uri") |
| 72 { |
| 73 # if there is no language translation, try canonical page for default langua
ge |
| 74 # example /es/page -> /page |
| 75 rewrite ^/([a-z][a-z])(/.+) $2 redirect; |
| 76 } |
| 56 } | 77 } |
| 57 | 78 |
| 58 <% if @multiplexer_locations %> | 79 <% if @multiplexer_locations %> |
| 59 <% @multiplexer_locations.each do |location| %> | 80 <% @multiplexer_locations.each do |location| %> |
| 60 location <%= location %> | 81 location <%= location %> |
| 61 { | 82 { |
| 62 fastcgi_pass unix:/tmp/multiplexer-fastcgi.sock; | 83 fastcgi_pass unix:/tmp/multiplexer-fastcgi.sock; |
| 63 include /etc/nginx/fastcgi_params; | 84 include /etc/nginx/fastcgi_params; |
| 64 } | 85 } |
| 65 <% end %> | 86 <% end %> |
| 66 <% end %> | 87 <% end %> |
| OLD | NEW |