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