标签: content-negotiation

使用 MultiViews 为语言配置 Apache 内容协商

我试图让MultiViews选项在 Apache 中工作,以根据Accept-Language请求中提供的内容改变返回到浏览器的内容。

我有以下配置:

Alias /multiviewstest "C:/MultiViews Test"

<Directory "C:/MultiViews Test">
    Options MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
Run Code Online (Sandbox Code Playgroud)

在我的C:\MultiViews Test目录中,我有以下文件:

  • spam.html
  • foo.html.en

当我请求返回http://localhost/multiviewstest/spam内容时spam.html。以下是请求和响应标头:

Host: localhost
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 3.5.30729)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache

Date: Fri, 08 May 2009 11:07:54 GMT
Server: Apache/2.2.10 (Win32)
Content-Location: spam.html …
Run Code Online (Sandbox Code Playgroud)

content-negotiation apache-2.2

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

标签 统计

apache-2.2 ×1

content-negotiation ×1