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 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:
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 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 }
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 %>
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