Skip to content

Instantly share code, notes, and snippets.

@osvaldasvalutis
Created November 16, 2017 12:59
Show Gist options
  • Save osvaldasvalutis/ab64aee24e5c55c343811a30c5741903 to your computer and use it in GitHub Desktop.
Save osvaldasvalutis/ab64aee24e5c55c343811a30c5741903 to your computer and use it in GitHub Desktop.
nginx multilingual 404 redirect
error_page 404 = @notfound;
location @notfound {
set $lang "sv";
if ($uri ~ "^/([a-z]{2})/(.*)$") {
set $lang $1;
}
rewrite ^ "/$lang/404/" break;
}
location / {
try_files $uri $uri/ =404;
}
Copy link

ghost commented Dec 29, 2020

Hello,

It seems not working or it doesn't seem to work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment