From 723c89d8f67c275ecbdfdad6d2e3b85efd55f31e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin=20Keskis=C3=A4rkk=C3=A4?= Date: Mon, 18 Sep 2023 11:14:03 +0200 Subject: [PATCH] redirect to versioned/latest files --- CEON/.htaccess | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/CEON/.htaccess b/CEON/.htaccess index 11a686b7a..dda9dcb5e 100644 --- a/CEON/.htaccess +++ b/CEON/.htaccess @@ -12,27 +12,24 @@ RewriteRule ^catalogue/?$ https://liusemweb.github.io/CEON/catalogue [R=308,L] # Redirect specific catalogue request RewriteRule ^catalogue/(.+)/?$ https://liusemweb.github.io/CEON/catalogue/$1 [R=303,NE,L] -# Redirect to latest version for RDF/XML -RewriteCond %{HTTP_ACCEPT} application/rdf\+xml -RewriteRule ^ontology/(\w+)/?$ https://liusemweb.github.io/CEON/ontology/$1/latest/$1.owl [R=303,NE,L] -# Redirect versioned request for RDF/XML +# Redirect request to versioned/latest RDF/XML RewriteCond %{HTTP_ACCEPT} application/rdf\+xml -RewriteRule ^ontology/(\w+)/([0-9]\.[0-9](?:\.[0-9])?)/?$ https://liusemweb.github.io/CEON/ontology/$1/$2/$1.owl [R=303,NE,L] +RewriteRule ^ontology/(\w+)/([0-9]\.[0-9](?:\.[0-9])?|latest)/?$ https://liusemweb.github.io/CEON/ontology/$1/$2/$1.rdf [R=303,NE,L] -# Redirect to latest version for Turtle +# Redirect request to versioned/latest Turtle RewriteCond %{HTTP_ACCEPT} text/turtle -RewriteRule ^ontology/(\w+)/?$ https://liusemweb.github.io/CEON/ontology/$1/latest/$1.ttl [R=303,NE,L] +RewriteRule ^ontology/(\w+)/([0-9]\.[0-9](?:\.[0-9])?|latest)/?$ https://liusemweb.github.io/CEON/ontology/$1/$2/$1.ttl [R=303,NE,L] -# Redirect versioned request for Turtle -RewriteCond %{HTTP_ACCEPT} text/turtle -RewriteRule ^ontology/(\w+)/([0-9]\.[0-9](?:\.[0-9])?)/?$ https://liusemweb.github.io/CEON/ontology/$1/$2/$1.ttl [R=303,NE,L] +# Redirect request to versioned/latest JSON-LD +RewriteCond %{HTTP_ACCEPT} application/ld\+json +RewriteRule ^ontology/(\w+)/([0-9]\.[0-9](?:\.[0-9])?|latest)/?$ https://liusemweb.github.io/CEON/ontology/$1/$2/$1.jsonld [R=303,NE,L] -# Redirect to latest version for any text-oriented MIME type to the documentation -RewriteRule ^ontology/(\w+)/?$ https://liusemweb.github.io/CEON/ontology/$1/latest/index.html [R=303,NE,L] +# Redirect to specific file +RewriteRule ^ontology/(\w+)/([0-9]\.[0-9](?:\.[0-9])?|latest)/(\w+\.(\w+))$ https://liusemweb.github.io/CEON/ontology/$1/$2/$3 [R=303,NE,L] # Redirect versioned request for any text-oriented MIME type to the documentation -RewriteRule ^ontology/(\w+)/([0-9]\.[0-9](?:\.[0-9])?)/?$ https://liusemweb.github.io/CEON/ontology/$1/$2/index.html [R=303,NE,L] +RewriteRule ^ontology/(\w+)/([0-9]\.[0-9](?:\.[0-9])?|latest)/?$ https://liusemweb.github.io/CEON/ontology/$1/$2/index.html [R=303,NE,L] # Default redirect for unmatched patterns to GitHub project RewriteRule ^.* https://github.com/LiUSemWeb/CEON [R=303,NE,L]