forked from perma-id/w3id.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.htaccess
95 lines (78 loc) · 4.38 KB
/
.htaccess
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
Options +FollowSymLinks
# Turn off MultiViews https://stackoverflow.com/a/25423722/646732
Options -MultiViews
# Directive to ensure *.rdf files served as appropriate content type,
# if not present in main apache config
AddType application/rdf+xml .rdf
AddType application/rdf+xml .owl
AddType text/turtle .ttl
AddType application/n-triples .n3
AddType application/ld+json .json
# Rewrite engine setup
RewriteEngine On
# code 308 permanent redirect, cacheable,
# The request method and the body will not be altered,
# whereas 301 may incorrectly sometimes be changed to a GET method.
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/308
# flag https://httpd.apache.org/docs/2.4/rewrite/flags.html
# L|last, if the rule matches, no further rules will be processed.
# NE|noescape, do not convert to hexcode equivalent
# OR, Combine rule conditions with a local OR instead of the implicit AND
# NC|nocase, case-insensitive.
# QSA|qsappend, query strings to be combined.
# http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewriterule
# Homepage
RewriteRule ^$ https://github.com/miranda-zhang/cloud-computing-schema [R=308,L]
# make sure we don't have the file or a directory index to serve
# the rest fails to redirect if we do
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule .* - [L]
# Rewrite rule to serve HTML content from the vocabulary URI if requested
# http://localhost/v0.1
RewriteCond %{HTTP_ACCEPT} !application/rdf\+xml.*(text/html|application/xhtml\+xml)
RewriteCond %{HTTP_ACCEPT} text/html [OR]
RewriteCond %{HTTP_ACCEPT} application/xhtml\+xml [OR]
RewriteCond %{HTTP_USER_AGENT} ^Mozilla/.*
RewriteRule ^v0\.1/?$ https://miranda-zhang.github.io/cloud-computing-schema/v0.1/index.htm [R=308,NE,L]
# http://localhost/v1.0
RewriteCond %{HTTP_ACCEPT} !application/rdf\+xml.*(text/html|application/xhtml\+xml)
RewriteCond %{HTTP_ACCEPT} text/html [OR]
RewriteCond %{HTTP_ACCEPT} application/xhtml\+xml [OR]
RewriteCond %{HTTP_USER_AGENT} ^Mozilla/.*
RewriteRule ^v1\.0/?$ https://miranda-zhang.github.io/cloud-computing-schema/v1.0/index-en.html [R=308,NE,L]
# Rewrite rule to serve JSON-LD content from the vocabulary URI if requested
# curl -H "Accept: application/ld+json" -L http://localhost/v1.0
RewriteCond %{HTTP_ACCEPT} application/ld\+json
RewriteRule ^v1\.0$ https://miranda-zhang.github.io/cloud-computing-schema/v1.0/ontology.json [R=308,L]
# Rewrite rule to serve RDF/XML content from the vocabulary URI if requested
# curl -H "Accept: application/rdf+xml" http://localhost/v0.1
RewriteCond %{HTTP_ACCEPT} \*/\* [OR]
RewriteCond %{HTTP_ACCEPT} application/rdf\+xml
RewriteRule ^v0\.1$ https://miranda-zhang.github.io/cloud-computing-schema/v0.1/ontology/cocoon.rdf [R=308,L]
# curl -LH "Accept: application/rdf+xml" http://localhost/v1.0
RewriteCond %{HTTP_ACCEPT} \*/\* [OR]
RewriteCond %{HTTP_ACCEPT} application/rdf\+xml
RewriteRule ^v1\.0$ https://miranda-zhang.github.io/cloud-computing-schema/v1.0/ontology.xml [R=308,L]
# Rewrite rule to serve N-Triples content from the vocabulary URI if requested
# curl -LH "Accept: application/n-triples" http://localhost/v1.0
RewriteCond %{HTTP_ACCEPT} application/n-triples
RewriteRule ^v1\.0$ https://miranda-zhang.github.io/cloud-computing-schema/v1.0/ontology.nt [R=308,L]
# Rewrite rule to serve TTL content from the vocabulary URI if requested
# curl -LH "Accept: text/turtle" http://localhost/v0.1
RewriteCond %{HTTP_ACCEPT} text/turtle [OR]
RewriteCond %{HTTP_ACCEPT} text/\* [OR]
RewriteCond %{HTTP_ACCEPT} \*/turtle
RewriteRule ^v0\.1$ https://miranda-zhang.github.io/cloud-computing-schema/v0.1/ontology/cocoon.ttl [R=308,L]
# curl -H "Accept: text/turtle" http://localhost/v1.0
RewriteCond %{HTTP_ACCEPT} text/turtle [OR]
RewriteCond %{HTTP_ACCEPT} text/\* [OR]
RewriteCond %{HTTP_ACCEPT} \*/turtle
RewriteRule ^v1\.0$ https://miranda-zhang.github.io/cloud-computing-schema/v1.0/ontology.ttl [R=308,L]
# The dataset index
RewriteRule ^data$ http://35.227.26.187:5000/cocoon_v1.0 [L,R=308,NC,NE]
# https://w3id.org/cocoon/data/storage/azure/premiumssd-p4
# http://35.227.26.187:5000/cocoon_v1.0?subject=https://w3id.org/cocoon/data/storage/azure/premiumssd-p4
# http://35.227.26.187:5000/cocoon_v1.0?subject=https://w3id.org/cocoon/data/storage/azure/premiumssd-p4&page=5
# https://stackoverflow.com/a/52842618/646732
RewriteRule ^data/.*$ http://35.227.26.187:5000/cocoon_v1.0?subject=https://w3id.org/cocoon/$0 [L,R=308,NC,NE,QSA]