Created
November 16, 2017 12:59
-
-
Save osvaldasvalutis/ab64aee24e5c55c343811a30c5741903 to your computer and use it in GitHub Desktop.
nginx multilingual 404 redirect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
It seems not working or it doesn't seem to work?