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

Side by Side Diff: modules/adblockplusorg/files/adblockplus.org

Issue 9048063: infrastructure: Redirects for the new website (Closed)
Patch Set: Created Dec. 19, 2012, 11:44 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 server { 1 server {
2 root /var/www/adblockplus.org/httpdocs; 2 root /var/www/adblockplus.org/httpdocs;
3 3
4 location / { 4 location / {
5 index index.php index index.html; 5 index index.php index index.html;
6 6
7 if ($arg_a = "view") { 7 if ($arg_a = "view") {
8 rewrite ^(.*) $1? permanent; 8 rewrite ^(.*) $1? permanent;
9 } 9 }
10 10
11 set $preferredLang en; 11 set $preferredLang en;
12 if ($http_accept_language ~ ^(\w\w)\b) { 12 if ($http_accept_language ~ ^(\w\w)\b) {
13 set $preferredLang $1; 13 set $preferredLang $1;
14 } 14 }
15 if (!-f $document_root/static/$preferredLang/index) { 15 if (!-f $document_root/static/$preferredLang/index) {
16 set $preferredLang en; 16 set $preferredLang en;
17 } 17 }
18 18
19 if ($arg_a ~ ^(view|show)?$) { 19 set $browser "firefox";
20 rewrite ^/(index\.html)?$ /$preferredLang/? redirect; 20 if ($http_user_agent ~ \bChrome/\d+) {
21 rewrite ^/(\w\w(_\w\w)?)$ /$1/ redirect; 21 set $browser "chrome";
22 }
23 if ($http_user_agent ~ \bPresto/\d+) {
24 set $browser "opera";
25 }
26 if ($http_user_agent ~ \bAndroid\s.*\bAppleWebKit/\d+) {
27 set $browser "android";
22 } 28 }
23 29
24 rewrite ^/(\w\w)/installation$ /$1/ permanent; 30 if ($arg_a ~ ^(view|show)?$) {
31 rewrite ^/(index\.html)?$ /$preferredLang/#$browser redirect;
32 rewrite ^/(\w\w(_\w\w)?)$ /$1/#$browser redirect;
33 }
34
35 rewrite ^/(\w\w(_\w\w)?)/(firefox|chrome|opera|android) /$1/#$3 permanent;
36 rewrite ^/(\w\w(_\w\w)?)/installation$ /$1/ permanent;
25 rewrite ^/anwiki/(.*) /$1 permanent; 37 rewrite ^/anwiki/(.*) /$1 permanent;
26 38
27 if (-f $request_filename) { 39 if (-f $request_filename) {
28 break; 40 break;
29 } 41 }
30 if (-d $request_filename) { 42 if (-d $request_filename) {
31 break; 43 break;
32 } 44 }
33 45
34 if ($http_user_agent ~ \bChrome/\d+) {
35 rewrite ^/(\w\w(_\w\w)?)/?$ /$1/chrome;
36 }
37 if ($http_user_agent ~ \bPresto/\d+) {
38 rewrite ^/(\w\w(_\w\w)?)/?$ /$1/opera;
39 }
40 if ($http_user_agent !~ \bChrome/\d+) {
41 rewrite ^/(\w\w(_\w\w)?)/?$ /$1/firefox;
42 }
43
44 set $static ""; 46 set $static "";
45 if (-f "$document_root/static$uri") { 47 if (-f "$document_root/static$uri") {
46 set $static "ok"; 48 set $static "ok";
47 } 49 }
48 if (-d "$document_root/static$uri") { 50 if (-d "$document_root/static$uri") {
49 set $static "ok"; 51 set $static "ok";
50 } 52 }
51 set $static "$static!$arg_a!$cookie_anwiki_anwsesscode"; 53 set $static "$static!$arg_a!$cookie_anwiki_anwsesscode";
52 if ($static ~ ^ok!(view|show)?!$) { 54 if ($static ~ ^ok!(view|show)?!$) {
53 rewrite (.*) /static$1 last; 55 rewrite (.*) /static$1 last;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 fastcgi_param GATEWAY_INTERFACE CGI/1.1; 123 fastcgi_param GATEWAY_INTERFACE CGI/1.1;
122 fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; 124 fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
123 125
124 fastcgi_param REMOTE_ADDR $remote_addr; 126 fastcgi_param REMOTE_ADDR $remote_addr;
125 fastcgi_param REMOTE_PORT $remote_port; 127 fastcgi_param REMOTE_PORT $remote_port;
126 fastcgi_param SERVER_ADDR $server_addr; 128 fastcgi_param SERVER_ADDR $server_addr;
127 fastcgi_param SERVER_PORT $server_port; 129 fastcgi_param SERVER_PORT $server_port;
128 fastcgi_param SERVER_NAME $server_name; 130 fastcgi_param SERVER_NAME $server_name;
129 } 131 }
130 } 132 }
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