Skip to content

Commit 224dcdb

Browse files
committed
nodejs.org: falling back to english when page hasn't been translated.
Refs nodejs/nodejs.org#490
1 parent 4030c77 commit 224dcdb

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

setup/www/resources/config/nodejs.org

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ server {
4545
}
4646

4747
location / {
48+
try_files $uri $uri/ @english_fallback;
49+
4850
location ~ \.json$ {
4951
add_header access-control-allow-origin *;
5052
}
@@ -59,6 +61,12 @@ server {
5961
add_header access-control-allow-origin *;
6062
}
6163
}
64+
65+
# instead of serving a 404 page when a page hasn't been translated
66+
location @english_fallback {
67+
rewrite ^/(it|ko)/(.*)$ http://nodejs.org/en/$2;
68+
return 404;
69+
}
6270
}
6371

6472
server {
@@ -215,11 +223,19 @@ server {
215223
location / {
216224
rewrite ^/$ /en/ redirect;
217225

226+
try_files $uri $uri/ @english_fallback;
227+
218228
location ~ \.json$ {
219229
add_header access-control-allow-origin *;
220230
}
221231
}
222232

233+
# instead of serving a 404 page when a page hasn't been translated
234+
location @english_fallback {
235+
rewrite ^/(it|ko)/(.*)$ https://nodejs.org/en/$2;
236+
return 404;
237+
}
238+
223239
location /download {
224240
alias /home/dist/nodejs;
225241
autoindex on;

0 commit comments

Comments
 (0)