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

Side by Side Diff: modules/adblockplus/templates/web/static.conf.erb

Issue 29733731: #7320 - Introduce helpcenter role (Closed)
Patch Set: A bit more documentation Created April 17, 2018, 7:58 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
OLDNEW
(Empty)
1 # Puppet: <%= @title %>
2
3 root /var/www/<%= @domain %>;
4 index index;
5 default_type text/html;
6 charset utf-8;
7
8 set $index_page "index";
9
10 <% if @custom_config %>
11 <%= @custom_config %>
12 <% end %>
13
14 location /
15 {
16 expires 1d;
17
18 # Redirect server/language root
19
20 rewrite ^/$ /$index_page last;
21 rewrite ^/([a-z][a-z](_[A-Z][A-Z])?)$ /$1/ permanent;
22 rewrite ^/([a-z][a-z](_[A-Z][A-Z])?)/$ /$1/$index_page last;
23
24 # Match Accept-Language header against available languages
25
26 set $language en;
27 set $region "";
28
29 if ($http_accept_language ~ ^([a-z][a-z])\b)
30 {
31 set $language $1;
32 }
33 if ($http_accept_language ~ ^([a-z][a-z])-([A-Z][A-Z])\b)
34 {
35 set $region $1;
36 }
37
38 if ($arg_fb_locale ~ ^([a-z][a-z])_([A-Z][A-Z])$)
39 {
40 set $language $1;
41 set $region $2;
42 }
43
44 # Redirect canonical URLs to language-specific versions
45
46 if (-e "$document_root/${language}_$region$uri")
47 {
48 rewrite ^(.*) /${language}_$region last;
49 }
50 if (-e "$document_root/$language$uri")
51 {
52 rewrite ^(.*) /$language$1 last;
53 }
54 if (-e "$document_root/en$uri")
55 {
56 rewrite ^(.*) /en$1 last;
57 }
58 }
59
60 # Redirect language URIs if no translations are found for the requested page
61
62 location ~ ^/([a-z][a-z]\_[A-Z][A-Z])(/.+)
63 {
64 if (!-e "$document_root$uri")
65 {
66 # if there is no language+region translation, try parent language URI
67 # example /es_MX/page -> /es/page
68 rewrite ^/([a-z][a-z])\_([A-Z][A-Z])(/.+) /$1$3 redirect;
69 }
70 }
71
72 location ~ ^/([a-z][a-z])(/.+)
73 {
74 if (!-e "$document_root$uri")
75 {
76 # if there is no language translation, try canonical page for default langua ge
77 # example /es/page -> /page
78 rewrite ^/([a-z][a-z])(/.+) $2 redirect;
79 }
80 }
OLDNEW
« no previous file with comments | « modules/adblockplus/templates/web/hooks_wrapper.sh.erb ('k') | modules/private-stub/hiera/hosts.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld