diff --git a/.htaccess b/.htaccess index aac1c18..a004f5f 100644 --- a/.htaccess +++ b/.htaccess @@ -1,5 +1,8 @@ +RewriteBase / +RewriteEngine On + AddDefaultCharset utf-8 -AddCharset UTF-8 .css .js +AddCharset UTF-8 .css .js .webmanifest FileETag MTime Size ServerSignature Off SetEnvIf Host ^ suppress-error-charset @@ -7,8 +10,18 @@ SetEnvIf Host ^ suppress-error-charset AddType image/x-icon .ico AddType application/manifest+json .webmanifest -ErrorDocument 403 https://kaboom.pw/ +RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] +RewriteRule ^ https://%1%{REQUEST_URI} [R=301,L] +RewriteCond %{ENV:HTTPS} !=on +RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] +RewriteCond %{HTTP_HOST} ^flame.ga$ +RewriteRule ^ https://kaboom.pw/$1 [R=301,L] +RewriteCond %{HTTP_HOST} ^www.flame.ga$ +RewriteRule ^ https://kaboom.pw/$1 [R=301,L] + ErrorDocument 404 https://kaboom.pw/ +RewriteCond %{REQUEST_FILENAME} -d +RewriteRule . - [R=404] Header set Content-Security-Policy "default-src 'none'; font-src data:; form-action 'self'; img-src 'self'; manifest-src 'self'; style-src 'self'; upgrade-insecure-requests" @@ -16,29 +29,56 @@ Header set X-Frame-Options "DENY" Header set X-Xss-Protection "1; mode=block" -RewriteEngine On -RewriteCond %{SERVER_PORT} 80 -RewriteRule ^(.*)$ https://kaboom.pw/$1 [R=301,L] -RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] -RewriteRule ^(.*)$ https://kaboom.pw/$1 [R=301,L] -RewriteCond %{HTTP_HOST} ^flame.ga$ -RewriteRule ^(.*)$ https://kaboom.pw/$1 [R=301,L] -RewriteCond %{HTTP_HOST} ^www.flame.ga$ -RewriteRule ^(.*)$ https://kaboom.pw/$1 [R=301,L] - -AddOutputFilterByType DEFLATE text/plain -AddOutputFilterByType DEFLATE text/html -AddOutputFilterByType DEFLATE text/xml -AddOutputFilterByType DEFLATE text/css -AddOutputFilterByType DEFLATE application/xml -AddOutputFilterByType DEFLATE application/xhtml+xml -AddOutputFilterByType DEFLATE application/rss+xml -AddOutputFilterByType DEFLATE application/javascript -AddOutputFilterByType DEFLATE application/x-javascript - Header set Referrer-Policy "no-referrer" Header set Strict-Transport-Security "max-age=63072000; includeSubdomains; preload" Header set Vary "Accept-Encoding" Header set X-Content-Type-Options "nosniff" Header unset Accept-Ranges Header unset Last-Modified + +RewriteCond %{HTTP:Accept-Encoding} br +RewriteCond %{REQUEST_FILENAME}.br -f +RewriteRule ^(.*)$ $1.br [L] + +RewriteCond %{HTTP:Accept-Encoding} gzip +RewriteCond %{REQUEST_FILENAME}.gz -f +RewriteRule ^(.*)$ $1.gz [L] + +AddEncoding br .br +AddEncoding gzip .gz + + +ForceType "text/css; charset=utf-8" + + + +ForceType image/x-icon + + + +ForceType "text/html; charset=utf-8" + + + +ForceType "text/javascript; charset=utf-8" + + + +ForceType "image/png; charset=utf-8" + + + +ForceType "image/svg+xml; charset=utf-8" + + + +ForceType "text/plain; charset=utf-8" + + + +ForceType "application/manifest+json; charset=utf-8" + + + +ForceType "text/xml; charset=utf-8" + diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..a346d86 --- /dev/null +++ b/build.sh @@ -0,0 +1,13 @@ +#!/bin/bash +cd $HOME/build-websites/kaboom-website/ +rm Gemfile.lock +bundle install +if jekyll build --destination $HOME/html/kaboom.pw/; then + cd $HOME/html/kaboom.pw/ + rm -rf *.br + rm -rf *.gz + for file in `find . -type f -name '*'`; do + $HOME/build-websites/zopfli $file + $HOME/build-websites/brotli $file + done +fi