configure one file with multiple mime types?

configure one file with multiple mime types?

am 16.03.2010 01:00:56 von ms419

How can I configure one file with multiple mime types?

The behaviour I want to achieve is that described here,
http://www.w3.org/TR/xhtml-media-types/

- when a file is requested and the user agent advertises
"application/xhtml+xml" in the "Accept:" request header, I want Apache
to respond with a "Content-Type: application/xhtml+xml" response header

- otherwise I want Apache to respond with a "Content-Type: text/html"
response header

I tried configuring both "application/xhtml+xml" and "text/html" mime
types with the "AddType" directive, without success - Apache always
responds with either "Content-Type: application/xhtml+xml" or
"Content-Type: text/html" - regardless of the "Accept:" request header

How can I configure one file with multiple mime types?

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org

Re: configure one file with multiple mime types?

am 18.03.2010 09:31:15 von Nick Kew

On 16 Mar 2010, at 00:00, Jack Bates wrote:

> How can I configure one file with multiple mime types?

Use mod_negotiation.

--
Nick Kew

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org

Re: configure one file with multiple mime types?

am 23.03.2010 19:57:11 von ms419

On Thu, Mar 18, 2010 at 08:31:15AM +0000, Nick Kew wrote:

> On 16 Mar 2010, at 00:00, Jack Bates wrote:
>
> > How can I configure one file with multiple mime types?
>
> Use mod_negotiation.

Thanks Nick - but I can't get type map working whatsoever : (

I created "manual.html.var",

URI: manual.html
Content-Type: application/xhtml+xml

I also added to my configuration,

AddHandler type-map .var

Now when I request manual.html.var, with "Accept: application/xhtml+xml",
Apache responds with the contents of manual.html - unfortunately it responds
with "Content-Type: text/html", not "Content-Type: application/xhtml+xml" : (

> GET /manual.html.var HTTP/1.1
> User-Agent: curl/7.20.0 (x86_64-pc-linux-gnu) libcurl/7.20.0 OpenSSL/0.9.8m
zlib/1.2.3.4 libidn/1.18 libssh2/1.2.2
> Host: ica-atom.org
> Accept: application/xhtml+xml
>
< HTTP/1.1 200 OK
< Date: Fri, 19 Mar 2010 20:29:25 GMT
< Server: Apache
< Content-Location: manual.html
< Vary: negotiate,Accept-Encoding
< TCN: choice
< Last-Modified: Fri, 19 Mar 2010 17:53:49 GMT
< ETag: "4e1d538-56f23-4822b07912540;4ddc005-35-4822d1dbe69c0"
< Accept-Ranges: bytes
< Content-Length: 356131
< Content-Type: text/html
<

I think by your suggestion to use mod_negotiation you're suggesting creating a
type map with,

URI: manual.html
Content-Type: application/xhtml+xml, text/html

- or -

URI: manual.html
Content-Type: application/xhtml+xml

URI: manual.html
Content-Type: text/html

^ I tried these as well - Apache always responds with "Content-Type: text/html"
: (

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org