1 Options -MultiViews -Indexes
2 DirectoryIndex index.plp
9 # redirect from deprecated domain names
10 RewriteCond %{HTTP_HOST} ^vim?\.shiar\.\w+$ [OR]
11 RewriteCond %{HTTP_HOST} =sheet.shiar.net
12 RewriteRule ^(vi(?=m$)|.*) http://sheet.shiar.nl/$1 [R=301]
14 # redirect old locations
15 RewriteRule ^vim$ /vi [R=301]
16 RewriteRule ^cc$ /countries [R=301]
18 # forward to https protocol if requested
19 RewriteCond %{HTTPS} =off
20 RewriteCond %{HTTP:Upgrade-Insecure-Requests} =1
21 RewriteCond %{HTTP_HOST} =sheet.shiar.nl
22 RewriteRule (.*) https://%{HTTP_HOST}/$1 [L]
24 # serve vim commands when requesting /digraphs.ex as well
25 RewriteRule ^(digraphs)\.ex(/.*)?$ $1.vim$2
27 # add .plp if a file exists with .plp appended (topdir only)
28 RewriteCond %{REQUEST_FILENAME} !-f
29 RewriteCond %{DOCUMENT_ROOT}/$1.plp -f
30 RewriteRule ^/*([^/]+)(.*) $1.plp$2
32 # replace jpeg images by webp alternatives if supported
33 RewriteCond %{HTTP_ACCEPT} \bimage/webp
34 RewriteCond %{DOCUMENT_ROOT}/$1.webp -f
35 RewriteRule (.*)\.jpg$ $1.webp
37 # allow browsers to cache static assets for upto a month
38 <IfModule headers_module>
39 <FilesMatch "\.(?:css|gif|png|jpg|webp|jxl|svg)$">
40 Header set Cache-Control "max-age=2592000"
42 <FilesMatch "\.(?:js|json)$">
43 Header set Cache-Control "max-age=2592000"
44 Header set Access-Control-Allow-Origin "*"