-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path.htaccess
More file actions
86 lines (74 loc) · 2.73 KB
/
Copy path.htaccess
File metadata and controls
86 lines (74 loc) · 2.73 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
# UPI QR Generator - Apache Configuration
# @author Prashant Thakur (@prashant64bit)
# @url https://prashantthakur.is-a.dev
# Optimizations for performance, caching, and security
# Enable GZIP Compression
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/atom+xml
</IfModule>
# Enable Browser Caching
<IfModule mod_expires.c>
ExpiresActive On
# HTML files
ExpiresByType text/html "access plus 7 days"
# CSS and JavaScript
ExpiresByType text/css "access plus 30 days"
ExpiresByType application/javascript "access plus 30 days"
ExpiresByType text/javascript "access plus 30 days"
# Images
ExpiresByType image/jpeg "access plus 60 days"
ExpiresByType image/gif "access plus 60 days"
ExpiresByType image/png "access plus 60 days"
ExpiresByType image/webp "access plus 60 days"
ExpiresByType image/x-icon "access plus 1 year"
# Default expiration
ExpiresDefault "access plus 7 days"
</IfModule>
# Cache Control Headers
<IfModule mod_headers.c>
<FilesMatch "\.(html|htm)$">
Header set Cache-Control "public, max-age=604800"
</FilesMatch>
<FilesMatch "\.(css|js)$">
Header set Cache-Control "public, max-age=2592000"
</FilesMatch>
<FilesMatch "\.(jpg|jpeg|png|gif|ico|webp)$">
Header set Cache-Control "public, max-age=5184000"
</FilesMatch>
</IfModule>
# Remove unnecessary headers
<IfModule mod_headers.c>
Header unset X-Powered-By
Header unset Server
</IfModule>
# Redirect http to https
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
# Force HTTPS and add security headers
<IfModule mod_headers.c>
Header set Strict-Transport-Security "max-age=31536000; includeSubDomains"
Header set X-Content-Type-Options "nosniff"
Header set X-Frame-Options "SAMEORIGIN"
Header set X-XSS-Protection "1; mode=block"
Header set Referrer-Policy "strict-origin-when-cross-origin"
</IfModule>
# Enable URL rewriting
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# Remove .html extension
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+?)/?$ index.html [L]
</IfModule>