-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.htaccess
More file actions
247 lines (209 loc) · 7.5 KB
/
.htaccess
File metadata and controls
247 lines (209 loc) · 7.5 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
# .htaccess für Neudert Stuckateur Website
# Performance, Sicherheit und SEO Optimierungen
# ======================================
# HTTPS Redirect (wenn SSL vorhanden)
# ======================================
# Aktivieren Sie dies, sobald SSL-Zertifikat installiert ist
# <IfModule mod_rewrite.c>
# RewriteEngine On
# RewriteCond %{HTTPS} off
# RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# </IfModule>
# ======================================
# WWW Redirect (optional)
# ======================================
# Wählen Sie EINE der beiden Optionen:
# Option 1: Mit WWW (www.stuckateur-neudert.de)
# <IfModule mod_rewrite.c>
# RewriteEngine On
# RewriteCond %{HTTP_HOST} !^www\. [NC]
# RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# </IfModule>
# Option 2: Ohne WWW (stuckateur-neudert.de)
# <IfModule mod_rewrite.c>
# RewriteEngine On
# RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
# RewriteRule ^(.*)$ https://%1%{REQUEST_URI} [L,R=301]
# </IfModule>
# ======================================
# Browser Caching
# ======================================
<IfModule mod_expires.c>
ExpiresActive On
# Bilder
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType image/webp "access plus 1 year"
ExpiresByType image/svg+xml "access plus 1 year"
ExpiresByType image/x-icon "access plus 1 year"
# CSS und JavaScript
ExpiresByType text/css "access plus 1 month"
ExpiresByType text/javascript "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
# Fonts
ExpiresByType font/ttf "access plus 1 year"
ExpiresByType font/otf "access plus 1 year"
ExpiresByType font/woff "access plus 1 year"
ExpiresByType font/woff2 "access plus 1 year"
ExpiresByType application/font-woff "access plus 1 year"
# HTML
ExpiresByType text/html "access plus 0 seconds"
</IfModule>
# ======================================
# GZIP Kompression
# ======================================
<IfModule mod_deflate.c>
# HTML, CSS, JavaScript, Text, XML
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/atom_xml
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE application/json
# Fonts
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/eot
AddOutputFilterByType DEFLATE application/font-woff
AddOutputFilterByType DEFLATE application/font-woff2
AddOutputFilterByType DEFLATE image/svg+xml
</IfModule>
# ======================================
# Cache-Control Headers
# ======================================
<IfModule mod_headers.c>
# 1 Jahr für Bilder
<FilesMatch "\.(jpg|jpeg|png|gif|webp|svg|ico)$">
Header set Cache-Control "max-age=31536000, public"
</FilesMatch>
# 1 Monat für CSS und JS
<FilesMatch "\.(css|js)$">
Header set Cache-Control "max-age=2592000, public"
</FilesMatch>
# Fonts
<FilesMatch "\.(ttf|otf|woff|woff2|eot)$">
Header set Cache-Control "max-age=31536000, public"
</FilesMatch>
# HTML - keine Cache
<FilesMatch "\.(html|htm)$">
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "0"
</FilesMatch>
</IfModule>
# ======================================
# Sicherheits Headers
# ======================================
<IfModule mod_headers.c>
# X-Frame-Options
Header always set X-Frame-Options "SAMEORIGIN"
# X-Content-Type-Options
Header always set X-Content-Type-Options "nosniff"
# X-XSS-Protection
Header always set X-XSS-Protection "1; mode=block"
# Referrer Policy
Header always set Referrer-Policy "strict-origin-when-cross-origin"
# Permissions Policy
Header always set Permissions-Policy "geolocation=(), microphone=(), camera=()"
# Content Security Policy (anpassen nach Bedarf)
# Header always set Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline';"
</IfModule>
# ======================================
# MIME Types
# ======================================
<IfModule mod_mime.c>
# Fonts
AddType font/ttf .ttf
AddType font/otf .otf
AddType font/woff .woff
AddType font/woff2 .woff2
AddType application/font-woff .woff
AddType application/font-woff2 .woff2
# SVG
AddType image/svg+xml .svg .svgz
# WebP
AddType image/webp .webp
# JavaScript
AddType application/javascript .js
# JSON
AddType application/json .json
</IfModule>
# ======================================
# ETags
# ======================================
<IfModule mod_headers.c>
Header unset ETag
</IfModule>
FileETag None
# ======================================
# Directory Index
# ======================================
DirectoryIndex index.html index.htm
# ======================================
# Fehlerseiten (optional)
# ======================================
# ErrorDocument 404 /404.html
# ErrorDocument 500 /500.html
# ======================================
# Hotlink Protection (optional)
# ======================================
# Verhindert, dass andere Websites Ihre Bilder einbetten
# <IfModule mod_rewrite.c>
# RewriteEngine on
# RewriteCond %{HTTP_REFERER} !^$
# RewriteCond %{HTTP_REFERER} !^https://(www\.)?stuckateur-neudert\.de/.*$ [NC]
# RewriteRule \.(jpg|jpeg|png|gif|webp|svg)$ - [F,L]
# </IfModule>
# ======================================
# PHP Settings (falls PHP verwendet wird)
# ======================================
# <IfModule mod_php7.c>
# php_value upload_max_filesize 10M
# php_value post_max_size 10M
# php_value max_execution_time 300
# php_value max_input_time 300
# </IfModule>
# ======================================
# Disable Directory Browsing
# ======================================
Options -Indexes
# ======================================
# Server Signature
# ======================================
ServerSignature Off
# ======================================
# URL Rewriting (Clean URLs)
# ======================================
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# Entfernt .html Endungen (optional)
# RewriteCond %{REQUEST_FILENAME} !-f
# RewriteCond %{REQUEST_FILENAME} !-d
# RewriteRule ^(.+)\.html$ /$1 [R=301,L]
# Trailing Slash entfernen (optional)
# RewriteCond %{REQUEST_FILENAME} !-d
# RewriteCond %{REQUEST_URI} (.+)/$
# RewriteRule ^ %1 [R=301,L]
</IfModule>
# ======================================
# Preload Header für kritische Ressourcen
# ======================================
<IfModule mod_headers.c>
<FilesMatch "\.html$">
Header add Link "</css/style.css>; rel=preload; as=style"
Header add Link "</js/main.js>; rel=preload; as=script"
</FilesMatch>
</IfModule>
# ======================================
# Character Encoding
# ======================================
AddDefaultCharset UTF-8