Skip to content

Commit bcd1896

Browse files
committed
处理en的404文件
1 parent 1f61d01 commit bcd1896

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

deploy/docker/nginx.conf

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,28 @@ server {
55
index index.html;
66

77
# 设置404错误页面
8-
error_page 404 /404.html;
8+
error_page 404 @handle_404;
9+
10+
# 处理404页面的逻辑
11+
location @handle_404 {
12+
# 检查是否为英文版本(以/en/开头)
13+
if ($uri ~ ^/en/) {
14+
return 302 /en/404.html;
15+
}
16+
# 默认返回中文404页面
17+
return 302 /404.html;
18+
}
919

1020
# 确保404.html能够正常访问
1121
location = /404.html {
1222
# 移除 internal 指令,允许直接访问404页面
1323
try_files $uri =404;
1424
}
25+
26+
# 确保英文版404.html能够正常访问
27+
location = /en/404.html {
28+
try_files $uri =404;
29+
}
1530

1631
# 重定向规则
1732
location = /use {

0 commit comments

Comments
 (0)