Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: modules/web/templates/site.conf.erb

Issue 29537689: #3299 - Add URI redirect for missing translations (Closed) Base URL: https://hg1/infrastructure
Left Patch Set: fix comments and whitespace Created Sept. 8, 2017, 1:38 p.m.
Right Patch Set: fix brackets and improve commit message Created Sept. 11, 2017, 8:51 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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
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
56 } 55 }
57 56
58 # Redirect language URIs if no translations are found for the requested page 57 # Redirect language URIs if no translations are found for the requested page
59 58
60 location ~ ^/([a-z][a-z]\_[A-Z][A-Z])(/.+) { 59 location ~ ^/([a-z][a-z]\_[A-Z][A-Z])(/.+)
mathias 2017/09/08 19:20:20 There's a newline missing in front of the bracket.
f.nicolaisen 2017/09/11 07:33:14 Acknowledged.
60 {
61 if (!-e "$document_root$uri") 61 if (!-e "$document_root$uri")
62 { 62 {
63 # if there is no language+region translation, try parent language URI 63 # if there is no language+region translation, try parent language URI
64 # example /es_MX/page -> /es/page 64 # example /es_MX/page -> /es/page
65 rewrite ^/([a-z][a-z])\_([A-Z][A-Z])(/.+) /$1$3 redirect; 65 rewrite ^/([a-z][a-z])\_([A-Z][A-Z])(/.+) /$1$3 redirect;
mathias 2017/09/08 19:20:20 This seems a bit quirky, it would move the user fr
f.nicolaisen 2017/09/11 07:33:14 Yes, this is quirky - if someone has manually chos
66 } 66 }
67 } 67 }
68 68
mathias 2017/09/08 19:20:20 There's a newline missing in front of the bracket.
f.nicolaisen 2017/09/11 07:33:14 Acknowledged.
69 location ~ ^/([a-z][a-z])(/.+) { 69 location ~ ^/([a-z][a-z])(/.+)
70 {
70 if (!-e "$document_root$uri") 71 if (!-e "$document_root$uri")
71 { 72 {
72 # if there is no language translation, try canonical page for default langua ge 73 # if there is no language translation, try canonical page for default langua ge
73 # example /es/page -> /page 74 # example /es/page -> /page
74 rewrite ^/([a-z][a-z])(/.+) $2 redirect; 75 rewrite ^/([a-z][a-z])(/.+) $2 redirect;
75 } 76 }
76 } 77 }
77 78
78 <% if @multiplexer_locations %> 79 <% if @multiplexer_locations %>
79 <% @multiplexer_locations.each do |location| %> 80 <% @multiplexer_locations.each do |location| %>
80 location <%= location %> 81 location <%= location %>
81 { 82 {
82 fastcgi_pass unix:/tmp/multiplexer-fastcgi.sock; 83 fastcgi_pass unix:/tmp/multiplexer-fastcgi.sock;
83 include /etc/nginx/fastcgi_params; 84 include /etc/nginx/fastcgi_params;
84 } 85 }
85 <% end %> 86 <% end %>
86 <% end %> 87 <% end %>
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld