fuzzyworld-tools / files / server / site-apps / htaccess
htaccess
| 1 | # apps.fuzzyworld.net. Installed as .htaccess by fuzzyworld-tools (server/install.sh). |
| 2 | # Every app lives in /<app>/ and is a static build uploaded by `fw deploy`. |
| 3 | Options -Indexes -Includes -ExecCGI |
| 4 | DirectoryIndex index.html |
| 5 | |
| 6 | RewriteEngine On |
| 7 | # www.<site> -> <site>, keeping path and query. |
| 8 | RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] |
| 9 | RewriteRule ^ https://%1%{REQUEST_URI} [R=301,L] |
| 10 | |
| 11 | # engye is hosted on Cloudflare Pages (it needs a Pages Function); keep old paths working. |
| 12 | RewriteRule ^engye(?:/(.*))?$ https://engye.fuzzyworld.net/$1 [R=301,L] |
| 13 | |
| 14 | # Apps are static; nothing here is executed on the server. |
| 15 | RemoveHandler .php .php3 .php4 .php5 .php7 .php8 .phtml .phar .shtml .cgi .pl .py |
| 16 | RemoveType .php .php3 .php4 .php5 .php7 .php8 .phtml .phar |
| 17 | <FilesMatch "\.(php\d?|phtml|phar|shtml|cgi|pl|py|sh)$"> |
| 18 | Require all denied |
| 19 | </FilesMatch> |
| 20 | <Files ".fuzzyworld.json"> |
| 21 | Require all denied |
| 22 | </Files> |
| 23 | |
| 24 | <IfModule mod_headers.c> |
| 25 | Header always set X-Content-Type-Options nosniff |
| 26 | Header always set Referrer-Policy strict-origin-when-cross-origin |
| 27 | # Entry points must revalidate so a deploy is picked up; hashed build assets never change. |
| 28 | <FilesMatch "(\.html|sw\.js|service-worker\.js|\.webmanifest|manifest\.json)$"> |
| 29 | Header set Cache-Control "no-cache" |
| 30 | </FilesMatch> |
| 31 | # Screenshots from CI runners keep their names when they are retaken. |
| 32 | <If "%{REQUEST_URI} =~ m#^/_shots/#"> |
| 33 | Header set Cache-Control "no-cache" |
| 34 | </If> |
| 35 | <If "%{REQUEST_URI} =~ m#^/[^/]+/assets/#"> |
| 36 | Header set Cache-Control "public, max-age=31536000, immutable" |
| 37 | </If> |
| 38 | </IfModule> |