-
Notifications
You must be signed in to change notification settings - Fork 0
/
.htaccess
43 lines (38 loc) · 1.45 KB
/
.htaccess
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File: .htaccess
# Author: Peter Nilsson (@ittykeys)
# Date: April 2, 2024
# License: © 2024 Peter Nilsson, released under the GPLv3 License. See LICENSE file for details.
# Description: .htaccess for custom errorpages, security, and language management
# Custom error documents
ErrorDocument 400 /html/errorpages/400.html
ErrorDocument 401 /html/errorpages/401.html
ErrorDocument 403 /html/errorpages/403.html
ErrorDocument 404 /html/errorpages/404.html
ErrorDocument 405 /html/errorpages/405.html
ErrorDocument 408 /html/errorpages/408.html
ErrorDocument 414 /html/errorpages/414.html
ErrorDocument 500 /html/errorpages/500.html
ErrorDocument 502 /html/errorpages/502.html
ErrorDocument 503 /html/errorpages/503.html
ErrorDocument 504 /html/errorpages/504.html
# Security
Options -Indexes
Header set X-XSS-Protection "1; mode=block"
Header set X-Content-Type-Options nosniff
Header set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
Header set X-FRAME-OPTIONS "sameorigin"
Header set Content-Security-Policy "frame-ancestors 'self';"
# SSI
Options +Includes
AddType text/html .html
AddOutputFilter INCLUDES .html
RewriteEngine On
RewriteRule .* - [E=YEAR:%{TIME_YEAR}]
# Serve different versions based on language
RewriteEngine On
RewriteCond %{HTTP:Accept-Language} ^sv [NC]
RewriteRule ^$ /index.html [L]
RewriteCond %{HTTP:Accept-Language} ^en [NC]
RewriteRule ^$ /index_en.html [L]
# Fallback to default version
RewriteRule ^$ /index.html [L]