I'm trying to overwrite the mime type of a file for a specific User Agent only (Chrome) and leave the default for the others (Firefox).
Options +Indexes
IndexOptions -FancyIndexing
Header set Access-Control-Allow-Origin "*"
RewriteEngine On
RewriteCond %{HTTP_HOST} !^example.org$
RewriteRule ^(.*)$ http://example.org/$1 [R=301,L]
# Turn off MultiViews
Options -MultiViews
# Directive to ensure *.rdf files served as appropriate content type,
# if not present in main apache config
AddType "application/rdf+xml" .rdf
AddType "text/turtle" .ttl
# Rewrite engine setup
RewriteBase /
# Rewrite rule to serve RDF/XML content from the vocabulary URI if requested
RewriteCond %{HTTP_ACCEPT} application/rdf\+xml
RewriteRule ^$ index.rdf [R=303]
# Rewrite rule to serve RDF/XML content from the vocabulary URI if requested
RewriteCond %{HTTP_ACCEPT} text/turtle
RewriteRule ^$ index.ttl [R=303]
# firefox display xml by default but downloads turtle
RewriteCond %{HTTP_USER_AGENT} Firefox/.*
RewriteRule ^$ index.rdf [R=303]
# make chrome display xml file with faking MIME type to application/xml instead application/rdf+xml
RewriteCond %{HTTP_USER_AGENT} ^.*Chrome/.*$
RewriteCond %{REQUEST_URI} ^/index.rdf$
RewriteRule ^index.rdf - [T=application/xml]
# Choose the default response (turtle for chrome safari ...which display turtle as raw text)
# Serve RDF/XML by default
RewriteRule ^$ index.ttl [R=303]
The reason for this is that the mimetype application/xml
gets displayed inline in chrome but application/rdf+xml
gets downloaded. I'd like to leave the it be at application/rdf+xml
and only change it for chrome. But with my config firefox also gets the wrong mimetype.