Skip to content

htaccess redirects for text/turtle etc #3

@stain

Description

@stain

I found that

http://rdf.greggkellogg.net/distiller

worked much better than pyRDFa, which fails for RDF/XML output.

something like (untested)

# Rewrite engine setup
RewriteEngine On

# Rewrite rule to serve HTML content
RewriteCond %{HTTP_ACCEPT} !(text/html|application/xhtml\+xml)
RewriteCond %{HTTP_ACCEPT} text/turtle [OR]
RewriteCond %{HTTP_ACCEPT} application/x-turtle [OR]
RewriteCond %{HTTP_ACCEPT} text/rdf+n3
RewriteRule ^ops$  http://rdf.greggkellogg.net/distiller?format=turtle&in_fmt=rdfa&uri=http://vocabularies.bridgedb.org/ops# [R=303,L]

# Rewrite rule to serve RDF/XML content if requested
RewriteCond %{HTTP_ACCEPT} !(text/html|application/xhtml\+xml)
RewriteCond %{HTTP_ACCEPT} application/rdf\+xml
RewriteRule ^ops$  http://rdf.greggkellogg.net/distiller?format=rdfxml&in_fmt=rdfa&uri=http://vocabularies.bridgedb.org/ops# [R=303,L]

RewriteCond %{HTTP_ACCEPT} !(text/html|application/xhtml\+xml)
RewriteCond %{HTTP_ACCEPT} application/ld+json [OR]
RewriteCond %{HTTP_ACCEPT} application/json
RewriteRule ^ops$  http://rdf.greggkellogg.net/distiller?format=jsonld&in_fmt=rdfa&uri=http://vocabularies.bridgedb.org/ops# [R=303,L]


RewriteCond %{HTTP_ACCEPT} application/n-triples
RewriteRule ^ops$  http://rdf.greggkellogg.net/distiller?format=ntriples&in_fmt=rdfa&uri=http://vocabularies.bridgedb.org/ops# [R=303,L]

# Choose the default response (as before)
RewriteRule ^ops$ index.html [L]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions