Re: SVG on the move? validator bug report

Le vendredi 01 octobre 2010 à 10:50 +0100, Jonathan Chetwynd a écrit :
> Francois,
> 
> I've also been investigating how to set my server up to serve mime  
> type text/html where accept header indicates svg is not supported.
> 
> however the best resource I found (from 2003) states:
> 
> Can I serve one resource with two distinct MIME-types?
> While it's theoretically possible, I don't know any way to do it  
> without breaking some important aspects of HTTP (such as proxying, or  
> the HTTP PUT method) - that is, the method I know using RewriteRules  
> doesn't set headers such as ETag as it should.
> http://www.w3.org/2003/01/xhtml-mimetype/content-negotiation
> wonder if Dom@w3.org could improve on this today?

The easy option if you can is to have two versions of your files with
two distinct extensions (as alluded in the page above).

If you can't, and don't need to deal with HTTP PUT, don't have E-Tags
enabled on your server, and don't care about caching, you can probably
make it work approximatively with rewriterules. 

Here is what it would look like for having html pages served both as
application/xhtml+html and text/html (assuming a default mime type of
text/html).
 RewriteCond %{HTTP_ACCEPT} application/xhtml\+xml
 RewriteCond %{HTTP_ACCEPT} !application/xhtml\+xml\s*;\s*q=0 
 RewriteCond %{REQUEST_FILENAME} .*\.html
 RewriteCond %{THE_REQUEST} HTTP/1\.1   
 RewriteRule .* - "[T=application/xhtml+xml]"

But I would hardly recommend it; and I don't think there are any other
ways to do this with Apache without using server-side scripting.

HTH

Dom

Received on Friday, 1 October 2010 13:05:45 UTC