httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Kuykendall <>
Subject [users@httpd] Q: How to config for multi-MIME type of a given resource
Date Thu, 17 Sep 2015 21:35:30 GMT

I need some help finding the relevant documentation and/or a solution for the following.


I have an Apache httpd server that I want to use to serve a variety of different formats for
the same resource URL.  Some of the resources are simple static files (OWL2 ontologies in
this case serialized as both RDF/XML and Turtle).

Additionally I have a Tomcat service that I want to use to silently intercept  requests text/html
and application/xhmtl versions of the resource.

I want the url rewrite/redirect/proxy to be invisible to the caller  (
with an Accept: text/html should go to
to generate the proper HTML documentation output but not change the URL as a  RewriteRule
does, so that the user still thinks the URL is

Use cases:

GET (Accept: application/rdf+xml)
Returns the /v1/ontology.owl file found in the htdocs

GET (Accept: text/turtle)
Returns the /v1/ontology.owl.ttl file found in the htdocs

GET (Accept: text/html)
Returns the response from forwarding the request to a Tomcat webapp running at

Additionally, I would like the URL to remain and  not get
rewritten or redirected where the client sees the webapp service's URL.

I currently have the following rewrite rules in place that do most of what I want.

RewriteCond %{HTTP_ACCEPT} !application/rdf\+xml.*(text/html|application/xhtml\+xml)
RewriteCond %{HTTP_ACCEPT} text/html [OR]
RewriteCond %{HTTP_ACCEPT} application/xhtml\+xml
RewriteRule ^/v1/ontology.owl$

RewriteCond %{HTTP_ACCEPT} application/rdf\+xml
RewriteRule ^/v1/ontology.owl$ /v1/ontology.owl [L]

# Rewrite rule to serve RDF/XML content from the vocabulary URI if requested
RewriteCond %{HTTP_ACCEPT} text/turtle
RewriteRule ^/v1/ontology.owl$ /v1/ontology.owl.ttl [L,R=303]

# Choose the default response
# ---------------------------
# Rewrite rule to serve the RDF/XML content from the vocabulary URI by default
RewriteRule ^/v1/ontology.owl$ /v1/ontology.owl [L]

How do I set up the config to handle the browser-friendly formats as described above?

Any help would be appreciated.  I've looked through the docs and searched the  net, but am
at a loss on figuring this one out.

Thank you very much for reading through this massive wall of text.  I appreciate any help

--------------------------------------------------- Confidentiality Notice: This electronic
mail transmission is confidential, may be privileged and should be read or retained only by
the intended recipient. If you have received this transmission in error, please immediately
notify the sender and delete it from your system.

View raw message