Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

htaccess redirects for text/turtle etc #3

Open
stain opened this issue Oct 1, 2015 · 1 comment
Open

htaccess redirects for text/turtle etc #3

stain opened this issue Oct 1, 2015 · 1 comment

Comments

@stain
Copy link
Member

stain commented Oct 1, 2015

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]
@stain
Copy link
Member Author

stain commented Oct 1, 2015

Obviously would also need to test for recursion depending on how rdf.greggkellogg requests /ops - perhaps use index.html instead as 'uri='?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants