|
| 1 | +# Rewrite engine setup |
| 2 | +RewriteEngine On |
| 3 | +#Change the path to the folder here |
| 4 | +RewriteBase / |
| 5 | + |
| 6 | +### |
| 7 | +# General rule (for n-2 generation: /codeLists/[CODELIST]) |
| 8 | +# HTML |
| 9 | +RewriteCond %{HTTP_ACCEPT} text/html [OR] |
| 10 | +RewriteCond %{HTTP_ACCEPT} application/xhtml\+xml |
| 11 | +# Match any path consisting only of alphabetical characters |
| 12 | +RewriteRule ^/codeLists/([0-9a-zA-Z]+)$ /$1-en.html [R=303,L] |
| 13 | +# OWL |
| 14 | +RewriteCond %{HTTP_ACCEPT} application/rdf\+xml |
| 15 | +RewriteRule ^/codeLists/([0-9a-zA-Z]+)$ /$1.owl [R=303,L] |
| 16 | +# CSV |
| 17 | +RewriteCond %{HTTP_ACCEPT} text/csv |
| 18 | +RewriteRule ^/codeLists/([0-9a-zA-Z]+)$ /$1.csv [R=303,L] |
| 19 | +# Turtle |
| 20 | +RewriteCond %{HTTP_ACCEPT} text/turtle [OR] |
| 21 | +RewriteCond %{HTTP_ACCEPT} application/x-turtle |
| 22 | +RewriteRule ^/codeLists/([0-9a-zA-Z]+)$ /$1.ttl [R=303,L] |
| 23 | +# N-Triples |
| 24 | +RewriteCond %{HTTP_ACCEPT} application/n-triples |
| 25 | +RewriteRule ^/codeLists/([0-9a-zA-Z]+)$ /$1.nt [R=303,L] |
| 26 | +# JSON-LD |
| 27 | +RewriteCond %{HTTP_ACCEPT} application/ld\+json |
| 28 | +RewriteRule ^/codeLists/([0-9a-zA-Z]+)$ /$1.jsonld [R=303,L] |
| 29 | +# Fallback to OWL format |
| 30 | +RewriteRule ^/codeLists/([A-ZA-Z]+)$ /$1.owl [R=303,L] |
| 31 | +### |
| 32 | + |
| 33 | +### |
| 34 | +# General rule (for previous generation: /[CODELIST]/[CODELIST]) |
| 35 | +# HTML |
| 36 | +RewriteCond %{HTTP_ACCEPT} text/html [OR] |
| 37 | +RewriteCond %{HTTP_ACCEPT} application/xhtml\+xml |
| 38 | +# Match any path consisting only of alphabetical characters |
| 39 | +RewriteRule ^([0-9a-zA-Z]+)/([0-9a-zA-Z]+)$ /$2-en.html [R=303,L] |
| 40 | +# OWL |
| 41 | +RewriteCond %{HTTP_ACCEPT} application/rdf\+xml |
| 42 | +RewriteRule ^([0-9a-zA-Z]+)/([0-9a-zA-Z]+)$ /$2.owl [R=303,L] |
| 43 | +# CSV |
| 44 | +RewriteCond %{HTTP_ACCEPT} text/csv |
| 45 | +RewriteRule ^([0-9a-zA-Z]+)/([0-9a-zA-Z]+)$ /$2.csv [R=303,L] |
| 46 | +# Turtle |
| 47 | +RewriteCond %{HTTP_ACCEPT} text/turtle [OR] |
| 48 | +RewriteCond %{HTTP_ACCEPT} application/x-turtle |
| 49 | +RewriteRule ^([0-9a-zA-Z]+)/([0-9a-zA-Z]+)$ /$2.ttl [R=303,L] |
| 50 | +# N-Triples |
| 51 | +RewriteCond %{HTTP_ACCEPT} application/n-triples |
| 52 | +RewriteRule ^([0-9a-zA-Z]+)/([0-9a-zA-Z]+)$ /$2.nt [R=303,L] |
| 53 | +# JSON-LD |
| 54 | +RewriteCond %{HTTP_ACCEPT} application/ld\+json |
| 55 | +RewriteRule ^([0-9a-zA-Z]+)/([0-9a-zA-Z]+)$ /$2.jsonld [R=303,L] |
| 56 | +# Fallback to OWL format |
| 57 | +RewriteRule ^([0-9a-zA-Z]+)/([0-9a-zA-Z]+)$ /$2.owl [R=303,L] |
| 58 | +### |
| 59 | + |
| 60 | +### |
| 61 | +### General rule (for current generation) |
| 62 | + |
| 63 | +# HTML |
| 64 | +RewriteCond %{HTTP_ACCEPT} text/html [OR] |
| 65 | +RewriteCond %{HTTP_ACCEPT} application/xhtml\+xml |
| 66 | +# Match any path consisting only of alphabetical characters |
| 67 | +RewriteRule ^([0-9a-zA-Z]+)$ /$1-en.html [R=303,L] |
| 68 | +# OWL |
| 69 | +RewriteCond %{HTTP_ACCEPT} application/rdf\+xml |
| 70 | +RewriteRule ^([0-9a-zA-Z]+)$ /$1.owl [R=303,L] |
| 71 | +# CSV |
| 72 | +RewriteCond %{HTTP_ACCEPT} text/csv |
| 73 | +RewriteRule ^([0-9a-zA-Z]+)$ /$1.csv [R=303,L] |
| 74 | +# Turtle |
| 75 | +RewriteCond %{HTTP_ACCEPT} text/turtle [OR] |
| 76 | +RewriteCond %{HTTP_ACCEPT} application/x-turtle |
| 77 | +RewriteRule ^([0-9a-zA-Z]+)$ /$1.ttl [R=303,L] |
| 78 | +# N-Triples |
| 79 | +RewriteCond %{HTTP_ACCEPT} application/n-triples |
| 80 | +RewriteRule ^([0-9a-zA-Z]+)$ /$1.nt [R=303,L] |
| 81 | +# JSON-LD |
| 82 | +RewriteCond %{HTTP_ACCEPT} application/ld\+json |
| 83 | +RewriteRule ^([0-9a-zA-Z]+)$ /$1.jsonld [R=303,L] |
| 84 | +# Fallback to OWL format |
| 85 | +RewriteRule ^([0-9a-zA-Z]+)$ /$1.owl [R=303,L] |
| 86 | +### |
| 87 | + |
0 commit comments