From 224dcdb75c9ac24449036837768e9afbd578938a Mon Sep 17 00:00:00 2001 From: Phillip Johnsen Date: Fri, 29 Jan 2016 22:51:03 +0100 Subject: [PATCH] nodejs.org: falling back to english when page hasn't been translated. Refs https://github.com/nodejs/nodejs.org/pull/490 --- setup/www/resources/config/nodejs.org | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/setup/www/resources/config/nodejs.org b/setup/www/resources/config/nodejs.org index df6c738c7..190d111a8 100644 --- a/setup/www/resources/config/nodejs.org +++ b/setup/www/resources/config/nodejs.org @@ -45,6 +45,8 @@ server { } location / { + try_files $uri $uri/ @english_fallback; + location ~ \.json$ { add_header access-control-allow-origin *; } @@ -59,6 +61,12 @@ server { add_header access-control-allow-origin *; } } + + # instead of serving a 404 page when a page hasn't been translated + location @english_fallback { + rewrite ^/(it|ko)/(.*)$ http://nodejs.org/en/$2; + return 404; + } } server { @@ -215,11 +223,19 @@ server { location / { rewrite ^/$ /en/ redirect; + try_files $uri $uri/ @english_fallback; + location ~ \.json$ { add_header access-control-allow-origin *; } } + # instead of serving a 404 page when a page hasn't been translated + location @english_fallback { + rewrite ^/(it|ko)/(.*)$ https://nodejs.org/en/$2; + return 404; + } + location /download { alias /home/dist/nodejs; autoindex on;