forked from PDFCraftTool/pdfcraft
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.htaccess
More file actions
122 lines (102 loc) · 4.17 KB
/
.htaccess
File metadata and controls
122 lines (102 loc) · 4.17 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# Apache .htaccess configuration for PDFCraft static export
# Enable rewrite engine
RewriteEngine On
# Handle trailing slash routing (matches Next.js trailingSlash: true config)
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{REQUEST_URI} !/$
RewriteRule ^(.*)$ /$1/ [R=301,L]
# Serve HTML files without extension
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^([^\.]+)$ $1.html [NC,L]
# ==========================================
# MIME Type Configuration
# ==========================================
AddType application/wasm .wasm
AddType application/javascript .mjs
AddType image/webp .webp
AddType image/avif .avif
AddType font/woff .woff
AddType font/woff2 .woff2
AddType font/ttf .ttf
AddType application/vnd.ms-fontobject .eot
# ==========================================
# Compression (mod_deflate)
# ==========================================
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css
AddOutputFilterByType DEFLATE text/javascript application/javascript application/x-javascript
AddOutputFilterByType DEFLATE application/xml application/xhtml+xml application/rss+xml
AddOutputFilterByType DEFLATE application/json application/wasm
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE font/woff font/woff2 font/ttf
</IfModule>
# ==========================================
# Caching (mod_expires)
# ==========================================
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 month"
# HTML - no cache
ExpiresByType text/html "access plus 0 seconds"
# JS/CSS - long cache
ExpiresByType text/css "access plus 1 year"
ExpiresByType text/javascript "access plus 1 year"
ExpiresByType application/javascript "access plus 1 year"
# Images - long cache
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/svg+xml "access plus 1 year"
ExpiresByType image/webp "access plus 1 year"
ExpiresByType image/avif "access plus 1 year"
ExpiresByType image/x-icon "access plus 1 year"
# Fonts - long cache
ExpiresByType font/woff "access plus 1 year"
ExpiresByType font/woff2 "access plus 1 year"
ExpiresByType font/ttf "access plus 1 year"
ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
# WASM - long cache
ExpiresByType application/wasm "access plus 1 year"
# JSON/XML - short cache
ExpiresByType application/json "access plus 1 hour"
ExpiresByType application/xml "access plus 1 hour"
</IfModule>
# ==========================================
# Cache-Control & Security Headers (mod_headers)
# ==========================================
<IfModule mod_headers.c>
# --- Security Headers (all responses) ---
Header always set X-Content-Type-Options "nosniff"
Header always set X-Frame-Options "SAMEORIGIN"
Header always set X-XSS-Protection "1; mode=block"
Header always set Referrer-Policy "strict-origin-when-cross-origin"
Header always set Permissions-Policy "camera=(), microphone=(), geolocation=()"
# Required for SharedArrayBuffer (LibreOffice WASM)
Header always set Cross-Origin-Opener-Policy "same-origin"
Header always set Cross-Origin-Embedder-Policy "require-corp"
Header always set Cross-Origin-Resource-Policy "cross-origin"
# --- Cache-Control ---
<FilesMatch "\.(js|css|mjs|woff|woff2|ttf|eot|png|jpg|jpeg|gif|ico|svg|webp|avif|wasm)$">
Header set Cache-Control "public, max-age=31536000, immutable"
</FilesMatch>
<FilesMatch "\.html$">
Header set Cache-Control "public, max-age=0, must-revalidate"
</FilesMatch>
<FilesMatch "sw\.js$">
Header set Cache-Control "public, max-age=0, must-revalidate"
</FilesMatch>
<FilesMatch "manifest\.json$">
Header set Cache-Control "public, max-age=3600"
</FilesMatch>
</IfModule>
# Error Documents
ErrorDocument 404 /404.html
# Prevent Directory Listing
Options -Indexes
# Disable ETags
<IfModule mod_headers.c>
Header unset ETag
</IfModule>
FileETag None