小编Mic*_*kel的帖子

用 PHP 构建的多语言(多语言)网站的自定义 404 页面

我有两种语言的网站,英语和荷兰语。

英文版在根 (public_html) 中,荷兰版在 /nl/ 目录中。

我的网站是用 PHP 构建的。

当链接断开(页面移动或不再存在)时,我希望讲荷兰语的人(荷兰人和比利时人)被重定向到荷兰语的 404 页面,其余的重定向到英语的 404 页面。

如何为此多语言(多语言)网站创建自定义 404 错误页面?请给我一个完整的代码,例如(php 和/或 .htaccess)。

我的 .htacces 文件包含以下几行:

# Instructs webbrowsers how to cache content
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 5 minutes"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon …
Run Code Online (Sandbox Code Playgroud)

php apache .htaccess multilingual

1
推荐指数
1
解决办法
1824
查看次数

标签 统计

.htaccess ×1

apache ×1

multilingual ×1

php ×1