You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Clive Miller <cl...@pluton.co.uk> on 2003/08/17 16:31:14 UTC

[users@httpd] Auto selection by MIME type

Hi,

I've searched through the directives, and checked FAQs, but can't find any
way to select a file according to requested MIME-TYPE. I wondered if a
conditional DocumentRoot might do it, but there don't seem to be any
appropriate condition setting directives.

I'd like to use it to return requests for text/html from one file, but
requests for text/vnd.wap.wml from another. Must be a common request,
surely!

I'm using Apache 1.3, but only have access to .htaccess as far as I'm aware.

Many thanks for any suggestions.

Clive


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> 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: [users@httpd] Auto selection by MIME type

Posted by Clive Miller <cl...@pluton.co.uk>.
Joshua, Robert,

Thanks for your comments. Alas, neither of those suggestions seem to work,
so I've written to the server administrator to ask if rewrite is disabled. I
think the rewrite would be the best option for me.

Clive
----- Original Message ----- 
From: "Joshua Slive" <jo...@slive.ca>
To: <us...@httpd.apache.org>; "Robert Andersson" <ro...@profundis.nu>
Sent: Monday, August 18, 2003 12:47 AM
Subject: Re: [users@httpd] Auto selection by MIME type


>
> On Mon, 18 Aug 2003, Robert Andersson wrote:
>
> > Clive Miller wrote:
> > > I've searched through the directives, and checked FAQs, but can't find
> > > any way to select a file according to requested MIME-TYPE.
> >
> > The client does not request a MIME type, since it doesn't know what MIME
> > type a certain resource has.
> >
> > What you want (or perhaps meant in the first place) is to select
contents
> > based on the client request's Accept: header. This is what Content
> > Negotiation does:
> > http://httpd.apache.org/docs/content-negotiation.html
>
> Yes, exactly.
>
> But one other alternative is available if you don't want to use full-blown
> content negotiation.  You can use mod_rewrite to peek into the Accept
> header and select content based on what it sees.  This is a little less
> elegant the using mod_negotiation, but it sometimes allows tighter
> control.
>
> Joshua.
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> 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
>
>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> 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: [users@httpd] Auto selection by MIME type

Posted by Joshua Slive <jo...@slive.ca>.
On Mon, 18 Aug 2003, Robert Andersson wrote:

> Clive Miller wrote:
> > I've searched through the directives, and checked FAQs, but can't find
> > any way to select a file according to requested MIME-TYPE.
>
> The client does not request a MIME type, since it doesn't know what MIME
> type a certain resource has.
>
> What you want (or perhaps meant in the first place) is to select contents
> based on the client request's Accept: header. This is what Content
> Negotiation does:
> http://httpd.apache.org/docs/content-negotiation.html

Yes, exactly.

But one other alternative is available if you don't want to use full-blown
content negotiation.  You can use mod_rewrite to peek into the Accept
header and select content based on what it sees.  This is a little less
elegant the using mod_negotiation, but it sometimes allows tighter
control.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> 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: [users@httpd] Auto selection by MIME type

Posted by Robert Andersson <ro...@profundis.nu>.
Clive Miller wrote:
> I've searched through the directives, and checked FAQs, but can't find
> any way to select a file according to requested MIME-TYPE.

The client does not request a MIME type, since it doesn't know what MIME
type a certain resource has.

What you want (or perhaps meant in the first place) is to select contents
based on the client request's Accept: header. This is what Content
Negotiation does:
http://httpd.apache.org/docs/content-negotiation.html

> I'd like to use it to return requests for text/html from one file, but
> equests for text/vnd.wap.wml from another. Must be a common request,
> surely!

Not too common, actually. I cannot recall seing this 'request' the last
years.

Regards,
Robert Andersson


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> 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