Skip to content

Commit

Permalink
OCO redirection via htaccess
Browse files Browse the repository at this point in the history
  • Loading branch information
essepuntato committed Feb 23, 2018
1 parent 340541c commit f015d97
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions oc/.htaccess
@@ -1,4 +1,34 @@
Header set Access-Control-Allow-Origin *
Options +FollowSymLinks
RewriteEngine on

# OCO [start]
RewriteRule ^ontology/([0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9])\.(html|xml|json|ttl|nt)$ https://opencitations.github.io/ontology/$1/ontology.$2 [R=303,L]
RewriteRule ^ontology\.(html|xml|json|ttl|nt)$ https://opencitations.github.io/ontology/current/ontology.$1 [R=303,L]

# Rewrite rule to serve HTML content from the vocabulary URI if requested
RewriteCond %{HTTP_ACCEPT} html
RewriteRule ^ontology(/[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9])?$ /oc/ontology$1.html [R=303,L]

# Rewrite rule to serve RDF/XML content from the vocabulary URI if requested
RewriteCond %{HTTP_ACCEPT} application/rdf\+xml [OR]
RewriteCond %{HTTP_ACCEPT} application/xml
RewriteRule ^ontology(/[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9])?$ /oc/ontology$1.xml [R=303,L]

# Rewrite rule to serve Turtle content from the vocabulary URI if requested
RewriteCond %{HTTP_ACCEPT} text/n3 [OR]
RewriteCond %{HTTP_ACCEPT} text/turtle
RewriteRule ^ontology(/[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9])?$ /oc/ontology$1.ttl [R=303,L]

# Rewrite rule to serve Notation3 content from the vocabulary URI if requested
RewriteCond %{HTTP_ACCEPT} application/n-triples [OR]
RewriteCond %{HTTP_ACCEPT} text/plain
RewriteRule ^ontology(/[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9])?$ /oc/ontology$1.nt [R=303,L]

# Rewrite rule to serve JSON-LD content from the vocabulary URI if requested
RewriteCond %{HTTP_ACCEPT} application/ld\+json [OR]
RewriteCond %{HTTP_ACCEPT} application/json
RewriteRule ^ontology(/[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9])?$ /oc/ontology$1.json [R=303,L]
# OCO [end]

RewriteRule ^(.*)$ http://opencitations.net/$1 [R=302,L]

0 comments on commit f015d97

Please sign in to comment.