Content Consolidation Using Mod_rewrite / RewriteCond Rules

I have an option: a set of files (the same RDF content with different serialization formats like RDF / XML, Turtle, and JSON-LD) on Github pages and use the w3id URL as a persistent identifier.

In addition, I want to have content matching at this permanent URL. That would be trivial if I hosted my files on an Apache server, but unfortunately the Github pages do not support content negotiation. So I'm trying to understand the extent to which I can do this with URL rewriting rules.

So, the idea is similar to the following.

GET http://w3id.org/foo  -- redirect to --> http://foo.git.io/content.ttl
Accept: text/turtle

GET http://w3id.org/foo  -- redirect to --> http://foo.git.io/content.jsonld
Accept: application/ld+json

Currently, my rules are as follows.

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_ACCEPT} ^.*application/rdf\+xml.* 
RewriteRule ^foaf$ http://nandana.imtqy.com/foaf/card.rdf [R=303,L]
RewriteCond %{HTTP_ACCEPT} ^.*text/turtle.* 
RewriteRule ^foaf$ http://nandana.imtqy.com/foaf/card.ttl [R=303,L]
RewriteCond %{HTTP_ACCEPT} ^.*application/ld\+json.* 
RewriteRule ^foaf$ http://nandana.imtqy.com/foaf/card.jsonld [R=303,L]
RewriteRule ^foaf$ http://nandana.imtqy.com/foaf/card.html [R=303,L]

, . , ,

Accept: application/rdf+xml;q=0.9,text/turtle

/rdf + xml ( ), . - ?

+4

All Articles