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

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

Issue 9103016: Fix url-based rewrites (Closed)
Patch Set: Made browser rewriting work for /en/ etc. Created Jan. 9, 2013, 10:43 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
(...skipping 11 matching lines...) Expand all
22 } 22 }
23 if ($http_user_agent ~ \bPresto/\d+) { 23 if ($http_user_agent ~ \bPresto/\d+) {
24 set $browser "opera"; 24 set $browser "opera";
25 } 25 }
26 if ($http_user_agent ~ \bAndroid\s.*\bAppleWebKit/\d+) { 26 if ($http_user_agent ~ \bAndroid\s.*\bAppleWebKit/\d+) {
27 set $browser "android"; 27 set $browser "android";
28 } 28 }
29 29
30 if ($arg_a ~ ^(view|show)?$) { 30 if ($arg_a ~ ^(view|show)?$) {
31 rewrite ^/(index\.html)?$ /$preferredLang/$browser redirect; 31 rewrite ^/(index\.html)?$ /$preferredLang/$browser redirect;
32 rewrite ^/(\w\w(_\w\w)?)$ /$1/$browser redirect; 32 rewrite ^/(\w\w(_\w\w)?)/?$ /$1/$browser redirect;
33 } 33 }
34 34
35 rewrite ^/(\w\w(_\w\w)?)/installation$ /$1/ permanent; 35 rewrite ^/(\w\w(_\w\w)?)/installation$ /$1/ permanent;
36 rewrite ^/anwiki/(.*) /$1 permanent; 36 rewrite ^/anwiki/(.*) /$1 permanent;
37 37
38 if (-f $request_filename) { 38 if (-f $request_filename) {
39 break; 39 break;
40 } 40 }
41 if (-d $request_filename) { 41 if (-d $request_filename) {
42 break; 42 break;
43 } 43 }
44 44
45 set $static_uri $uri; 45 set $static_uri $uri;
46 if ($uri ~ ^/(\w\w(_\w\w)?)/(firefox|chrome|opera|android)) { 46 if ($uri ~ ^/(\w\w(_\w\w)?)/(firefox|chrome|opera|android)/?$) {
47 set $static_uri "/$1/"; 47 set $static_uri "/$1/";
48 set $browser $3; 48 set $browser $3;
49 } 49 }
50 set $static ""; 50 set $static "";
51 if (-f "$document_root/static$static_uri") { 51 if (-f "$document_root/static$static_uri") {
52 set $static "ok"; 52 set $static "ok";
53 } 53 }
54 if (-d "$document_root/static$static_uri") { 54 if (-d "$document_root/static$static_uri") {
55 set $static "ok"; 55 set $static "ok";
56 } 56 }
57 set $static "$static!$arg_a!$cookie_anwiki_anwsesscode"; 57 set $static "$static!$arg_a!$cookie_anwiki_anwsesscode";
58 if ($static ~ ^ok!(view|show)?!$) { 58 if ($static ~ ^ok!(view|show)?!$) {
59 rewrite ^ /static$static_uri?browser=$browser last; 59 rewrite ^ /static$static_uri?browser=$browser last;
60 } 60 }
61 61
62 rewrite ^/(\w\w(_\w\w)?)/(firefox|chrome|opera|android) /index.php?p=$1&brow ser=$3 last; 62 rewrite ^/(\w\w(_\w\w)?)/(firefox|chrome|opera|android)/?$ /index.php?p=$1&b rowser=$3 last;
63 rewrite ^/(.*) /index.php?p=$1 last; 63 rewrite ^/(.*) /index.php?p=$1 last;
64 } 64 }
65 65
66 location /static/ { 66 location /static/ {
67 index index; 67 index index;
68 internal; 68 internal;
69 types { 69 types {
70 image/png png; 70 image/png png;
71 text/xml xml; 71 text/xml xml;
72 text/css css; 72 text/css css;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 fastcgi_param GATEWAY_INTERFACE CGI/1.1; 108 fastcgi_param GATEWAY_INTERFACE CGI/1.1;
109 fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; 109 fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
110 110
111 fastcgi_param REMOTE_ADDR $remote_addr; 111 fastcgi_param REMOTE_ADDR $remote_addr;
112 fastcgi_param REMOTE_PORT $remote_port; 112 fastcgi_param REMOTE_PORT $remote_port;
113 fastcgi_param SERVER_ADDR $server_addr; 113 fastcgi_param SERVER_ADDR $server_addr;
114 fastcgi_param SERVER_PORT $server_port; 114 fastcgi_param SERVER_PORT $server_port;
115 fastcgi_param SERVER_NAME $server_name; 115 fastcgi_param SERVER_NAME $server_name;
116 } 116 }
117 } 117 }
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