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: try language if no translation for region Created Sept. 7, 2017, 8:36 a.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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 rewrite ^(.*) /en$1 last; 47 rewrite ^(.*) /en$1 last;
48 } 48 }
49 49
50 # Redirect server/language root 50 # Redirect server/language root
51 51
52 rewrite ^/$ /$index_page last; 52 rewrite ^/$ /$index_page last;
53 rewrite ^/(\w\w(_\w\w)?)$ /$1/ permanent; 53 rewrite ^/(\w\w(_\w\w)?)$ /$1/ permanent;
54 rewrite ^/(\w\w(_\w\w)?)/$ /$1/$index_page last; 54 rewrite ^/(\w\w(_\w\w)?)/$ /$1/$index_page last;
55 } 55 }
56 56
57 # http://hub.eyeo.com/issues/3299 Redirect missing translations to default
58 location ~ ^/([a-z][a-z]\_[A-Z][A-Z])(/.+) {
59 if (!-e "$document_root$uri")
60 {
61 # if there is no /es_Mx/page, redirect to /es/page instead:
62 rewrite ^/([a-z][a-z])\_([A-Z][A-Z])(/.+) /$1$3 redirect;
63 }
64 }
65
66 location ~ ^/([a-z][a-z])(/.+) {
67 if (!-e "$document_root$uri")
68 {
69 # if there is no /es/page, redirect to /page instead:
70 rewrite ^/([a-z][a-z])(/.+) $2 redirect;
71 }
72 }
73
57 <% if @multiplexer_locations %> 74 <% if @multiplexer_locations %>
58 <% @multiplexer_locations.each do |location| %> 75 <% @multiplexer_locations.each do |location| %>
59 location <%= location %> 76 location <%= location %>
60 { 77 {
61 fastcgi_pass unix:/tmp/multiplexer-fastcgi.sock; 78 fastcgi_pass unix:/tmp/multiplexer-fastcgi.sock;
62 include /etc/nginx/fastcgi_params; 79 include /etc/nginx/fastcgi_params;
63 } 80 }
64 <% end %> 81 <% end %>
65 <% end %> 82 <% 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