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

Unified Diff: modules/adblockplusorg/files/adblockplus.org

Issue 9048063: infrastructure: Redirects for the new website (Closed)
Patch Set: Created Dec. 19, 2012, 4:25 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: modules/adblockplusorg/files/adblockplus.org
===================================================================
--- a/modules/adblockplusorg/files/adblockplus.org
+++ b/modules/adblockplusorg/files/adblockplus.org
@@ -16,12 +16,23 @@
set $preferredLang en;
}
- if ($arg_a ~ ^(view|show)?$) {
- rewrite ^/(index\.html)?$ /$preferredLang/? redirect;
- rewrite ^/(\w\w(_\w\w)?)$ /$1/ redirect;
+ set $browser "firefox";
+ if ($http_user_agent ~ \bChrome/\d+) {
+ set $browser "chrome";
+ }
+ if ($http_user_agent ~ \bPresto/\d+) {
+ set $browser "opera";
+ }
+ if ($http_user_agent ~ \bAndroid\s.*\bAppleWebKit/\d+) {
+ set $browser "android";
}
- rewrite ^/(\w\w)/installation$ /$1/ permanent;
+ if ($arg_a ~ ^(view|show)?$) {
+ rewrite ^/(index\.html)?$ /$preferredLang/$browser redirect;
+ rewrite ^/(\w\w(_\w\w)?)$ /$1/$browser redirect;
+ }
+
+ rewrite ^/(\w\w(_\w\w)?)/installation$ /$1/ permanent;
rewrite ^/anwiki/(.*) /$1 permanent;
if (-f $request_filename) {
@@ -31,28 +42,24 @@
break;
}
- if ($http_user_agent ~ \bChrome/\d+) {
- rewrite ^/(\w\w(_\w\w)?)/?$ /$1/chrome;
+ set $static_uri $uri;
+ if ($uri ~ ^/(\w\w(_\w\w)?)/(firefox|chrome|opera|android)) {
+ set $static_uri "/$1";
}
- if ($http_user_agent ~ \bPresto/\d+) {
- rewrite ^/(\w\w(_\w\w)?)/?$ /$1/opera;
- }
- if ($http_user_agent !~ \bChrome/\d+) {
- rewrite ^/(\w\w(_\w\w)?)/?$ /$1/firefox;
- }
-
set $static "";
- if (-f "$document_root/static$uri") {
+ if (-f "$document_root/static$static_uri") {
set $static "ok";
}
- if (-d "$document_root/static$uri") {
+ if (-d "$document_root/static$static_uri") {
set $static "ok";
}
set $static "$static!$arg_a!$cookie_anwiki_anwsesscode";
if ($static ~ ^ok!(view|show)?!$) {
- rewrite (.*) /static$1 last;
+ rewrite ^/(\w\w(_\w\w)?)/(firefox|chrome|opera|android) /static/$1/?browser=$3 last;
+ rewrite (.*) /static/$1 last;
Wladimir Palant 2012/12/19 16:41:56 Do we need the special case and code duplication f
Felix Dahlke 2012/12/19 20:01:23 You're right, changed that part. I was a bit worri
}
+ rewrite ^/(\w\w(_\w\w)?)/(firefox|chrome|opera|android) /index.php?p=$1&browser=$3 last;
rewrite ^/(.*) /index.php?p=$1 last;
}
@@ -67,41 +74,13 @@
default_type text/html;
charset utf-8;
- set $browserClass ' nongecko';
- if ($http_user_agent ~ \bGecko/\d+) {
- set $browserClass ' gecko';
- }
- if ($http_user_agent ~ \bK-Meleon\b) {
- set $browserClass ' kmeleon';
- }
- if ($http_user_agent ~ \bChrome/\d+) {
- set $browserClass ' chrome';
- }
- if ($http_user_agent ~ \bPresto/\d+) {
- set $browserClass ' opera';
- }
- sub_filter ' id="content" class="multicolumn"' ' id="content" class="multicolumn$browserClass"';
+ sub_filter ' id="content"' ' id="content" class="$arg_browser"';
Wladimir Palant 2012/12/19 16:41:56 Note that this will affect all pages, not just the
Felix Dahlke 2012/12/19 20:01:23 I've tried to put that sub_filter inside an if, bu
}
location ~ \.php$ {
client_max_body_size 8m;
- set $browserClass ' nongecko';
- if ($http_user_agent ~ \bGecko/\d+) {
- set $browserClass ' gecko';
- }
- if ($http_user_agent ~ \bK-Meleon\b) {
- set $browserClass ' kmeleon';
- }
- if ($http_user_agent ~ \bChrome/\d+) {
- set $browserClass ' chrome';
- }
- if ($http_user_agent ~ \bPresto/\d+) {
- set $browserClass ' opera';
- }
- sub_filter ' id="content" class="multicolumn"' ' id="content" class="multicolumn$browserClass"';
-
fastcgi_pass unix:/tmp/php-fastcgi.sock;
fastcgi_index index.php;
@@ -126,5 +105,7 @@
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
+
+ sub_filter ' id="content"' ' id="content" class="$arg_browser"';
Wladimir Palant 2012/12/19 16:41:56 Nit: you probably should leave sub_filter in the s
Felix Dahlke 2012/12/19 20:01:23 Done. Thought it made more sense down there but yo
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld