如何在htaccess中编写错误记录命令取决于语言URL?
在一个多语言网站中,我需要为每种语言设置自定义404页。我想从URL获取语言。
www .../lang/page/
如何在.htaccess
中编写errordocument
命令,以便取决于语言URL?
ErrorDocument 404 /404/
In a multi language website, where I need to set up a custom 404 page for each language. I want to get language from URL.
www.../lang/page/
How to write ErrorDocument
command in .htaccess
so that it depends on the language URL?
ErrorDocument 404 /404/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设语言代码是请求的URL路径的第一个路径段中的两个字符小写字符串。如果不存在,则默认为
en
。尝试以下内容:
使用表达式语法生成动态
errordocument
字符串,并获取环境变量的值需要Apache 2.4.13+。参考:
Assuming the language code is a two character lowercase string in the first path segment of the requested URL-path. If absent, this defaults to
en
.Try the following:
Using expression syntax to generate a dynamic
ErrorDocument
string and get the value of the environment variable requires Apache 2.4.13+.Reference: