Task – return different pages depends on user browser language.
i.e. different html if backend return error. And for domain it.randomthemes.com always return english error page on backend error.
nginx.conf
map $http_accept_language $lang {
default en;
~ru ru;
}
default en;
~ru ru;
}
Server context:
set $ep /50x.html; #default error page
if ( $host ~* it.randomthemes.com ) {
set $ep /50x.en.html;
}
if ( $lang ~* en ) {
set $ep /50x.en.html;
}
error_page 503 /dinner.html;
error_page 500 502 504 $ep;
error_page 400 /400.html;
if ( $host ~* it.randomthemes.com ) {
set $ep /50x.en.html;
}
if ( $lang ~* en ) {
set $ep /50x.en.html;
}
error_page 503 /dinner.html;
error_page 500 502 504 $ep;
error_page 400 /400.html;
Recent Comments