Skip to content

Commit

Permalink
Merge pull request perma-id#4615 from marioscrock/master
Browse files Browse the repository at this point in the history
Add support for modules in pko .htaccess
  • Loading branch information
dgarijo authored Dec 20, 2024
2 parents ae39b51 + 4e7bea9 commit 26c382f
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions pko/.htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -17,35 +17,53 @@ SetEnvIf Accept ^.*application/json-ld.* SYNTAX=json
SetEnvIf Accept ^.*application/n-triples.* SYNTAX=nt
SetEnvIf Accept ^.*text/html.* SYNTAX=html
SetEnvIf Accept ^\*/\*$ SYNTAX=ttl
SetEnvIf Request_URI ^.*$ ROOT_URL=https://perks-project.github.io/pk-ontology/pko
SetEnvIf Request_URI ^.*$ ROOT_URL=https://perks-project.github.io/pk-ontology

##### Ontology #####

# Versioned ontology releases
RewriteCond %{ENV:SYNTAX} ^(rdf|ttl|json|nt)$
RewriteRule ^([0-9].[0-9].[0-9])/?$ %{ENV:ROOT_URL}/$1/pko.%{ENV:SYNTAX} [R=303,L]
RewriteRule ^([0-9].[0-9].[0-9])/?$ %{ENV:ROOT_URL}/pko/$1/pko.%{ENV:SYNTAX} [R=303,L]

# Latest ontology releases
RewriteCond %{ENV:SYNTAX} ^(rdf|ttl|json|nt)$
RewriteRule ^/?$ %{ENV:ROOT_URL}/latest/pko.%{ENV:SYNTAX} [R=303,L]
RewriteRule ^/?$ %{ENV:ROOT_URL}/pko/latest/pko.%{ENV:SYNTAX} [R=303,L]

# Versioned ontology documentation
RewriteCond %{ENV:SYNTAX} ^html$
RewriteRule ^([0-9].[0-9].[0-9])/?$ %{ENV:ROOT_URL}/$1/index.html [R=303,L]
RewriteRule ^([0-9].[0-9].[0-9])/?$ %{ENV:ROOT_URL}/pko/$1/index.html [R=303,L]

# Latest ontology documentation
RewriteCond %{ENV:SYNTAX} ^html$
RewriteRule ^/?$ %{ENV:ROOT_URL}/latest/index.html [R=303,L]
RewriteRule ^/?$ %{ENV:ROOT_URL}/pko/latest/index.html [R=303,L]

# No serialisation available
RewriteCond %{ENV:SYNTAX} ^other$
RewriteRule ^/?$ %{ENV:ROOT_URL}/406.html [R=406,L]

##### PKO modules #####

# Versioned vocabulary
RewriteCond %{ENV:SYNTAX} ^(rdf|ttl|json|nt)$
RewriteRule ^(.+)/([0-9].[0-9].[0-9])/?$ %{ENV:ROOT_URL}/$1/$2/$1.%{ENV:SYNTAX} [R=303,L]

# Latest vocabulary
RewriteCond %{ENV:SYNTAX} ^(rdf|ttl|json|nt)$
RewriteRule ^([^/]+)/?$ %{ENV:ROOT_URL}/$1/latest/$1.%{ENV:SYNTAX} [R=303,L]

# Versioned documentation
RewriteCond %{ENV:SYNTAX} ^html$
RewriteRule ^(.+)/([0-9].[0-9].[0-9])/?$ %{ENV:ROOT_URL}/$1/$2/index.html [R=303,L,NE]

# Vocabulary documentation
RewriteCond %{ENV:SYNTAX} ^html$
RewriteRule ^([^/]+)/?$ %{ENV:ROOT_URL}/$1/latest/index.html [R=303,L,NE]

##### Default #####

# Specification repo
RewriteCond %{ENV:MARKER} ^other$
RewriteRule ^.*$ https://github.com/perks-project/pk-ontology [R=303,L]

# Default response
RewriteRule ^.*$ https://github.com/perks-project/pk-ontology [R=303,L]
RewriteRule ^.*$ https://github.com/perks-project/pk-ontology [R=303,L]

0 comments on commit 26c382f

Please sign in to comment.