index: release v1.18 with only altgr index linked
[sheet.git] / .htaccess
1 Options        -MultiViews -Indexes
2 DirectoryIndex index.plp
3 DirectorySlash Off
4 AddCharset     utf-8 .txt
5
6 RewriteEngine  on
7 RewriteBase    /
8
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]
13
14 # redirect old locations
15 RewriteRule ^vim$                    /vi                      [R=301]
16 RewriteRule ^cc$                     /countries               [R=301]
17
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]
23
24 # serve vim commands when requesting /digraphs.ex as well
25 RewriteRule ^(digraphs)\.ex(/.*)?$   $1.vim$2
26
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
31
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
36
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"
41 </FilesMatch>
42 <FilesMatch "\.(?:js|json)$">
43 Header set Cache-Control "max-age=2592000"
44 Header set Access-Control-Allow-Origin "*"
45 </FilesMatch>
46 </IfModule>
47