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