0

我们想创建一个不同的语言页面,这取决于浏览器语言但是它没有选择 fr 和 zh 错误页面,有谁知道我错过了什么?

RewriteCond %{HTTP:Accept-Language} ^fr [NC]
ErrorDocument 404 /notfound_fr.html

RewriteCond %{HTTP:Accept-Language} ^zh [NC]
ErrorDocument 404 /notfound_zh.html

#RewriteCond %{HTTP:Accept-Language} !(^fr|^zh) [NC]
ErrorDocument 404 /notfound.html
4

2 回答 2

0

正如 Deadooshka 提到的,解决方案是:

RewriteCond %{HTTP:Accept-Language} ^zh [NC]
RewriteRule ^/notfound.html$ /notfound_zh.html [P,L]

RewriteCond %{HTTP:Accept-Language} ^fr [NC]
RewriteRule ^/notfound.html$ /notfound_f.html [P,L]
于 2014-10-29T17:26:11.127 回答
0

我目前正在为我的 .htaccess 测试类似以下代码的内容。到目前为止,它运行良好:

<If "req('accept-language') =~ m#^fr#i">
ErrorDocument 404 /notfound_fr.html
</If>
<ElseIf "req('accept-language') =~ m#^zh#i">
ErrorDocument 404 /notfound_zh.html
</ElseIf>
<Else>
ErrorDocument 404 /notfound.html
</Else>
于 2018-04-24T18:49:25.740 回答