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

Side by Side Diff: modules/web/templates/site.conf.erb

Issue 29537689: #3299 - Add URI redirect for missing translations (Closed) Base URL: https://hg1/infrastructure
Patch Set: fix comments and whitespace Created Sept. 8, 2017, 1:38 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 } 56 }
57 57
58 # Redirect language URIs if no translations are found for the requested page
59
60 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.
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;
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 }
67 }
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])(/.+) {
70 if (!-e "$document_root$uri")
71 {
72 # if there is no language translation, try canonical page for default langua ge
73 # example /es/page -> /page
74 rewrite ^/([a-z][a-z])(/.+) $2 redirect;
75 }
76 }
77
58 <% if @multiplexer_locations %> 78 <% if @multiplexer_locations %>
59 <% @multiplexer_locations.each do |location| %> 79 <% @multiplexer_locations.each do |location| %>
60 location <%= location %> 80 location <%= location %>
61 { 81 {
62 fastcgi_pass unix:/tmp/multiplexer-fastcgi.sock; 82 fastcgi_pass unix:/tmp/multiplexer-fastcgi.sock;
63 include /etc/nginx/fastcgi_params; 83 include /etc/nginx/fastcgi_params;
64 } 84 }
65 <% end %> 85 <% end %>
66 <% end %> 86 <% end %>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld