1
|
# -----------------------------------------------------------------------------
|
2
|
# Important Notice on own Redirects/Rewrites
|
3
|
# -----------------------------------------------------------------------------
|
4
|
|
5
|
## It's easily possible to put own Redirects and Rewrites into this file. Please note our comments hinting the best place to do this below.
|
6
|
|
7
|
# -----------------------------------------------------------------------------
|
8
|
# Htaccess Version
|
9
|
# -----------------------------------------------------------------------------
|
10
|
|
11
|
## By checking this variable from the Shop we can guess if htaccess Directives are current
|
12
|
## Since some hosters do provide apache mod_env and others only mod_envif we need to do some doubling
|
13
|
##
|
14
|
## Important: After changing the version, you have to update the version_ino/htaccessVersion.php file too.
|
15
|
|
16
|
<FilesMatch ".+\.ph(ar|p|tml)$">
|
17
|
SetHandler "proxy:unix:/run/php/php7.3-fpm.sock|fcgi://localhost"
|
18
|
</FilesMatch>
|
19
|
|
20
|
<IfModule mod_env.c>
|
21
|
SetEnv gambio_htaccessVersion 3.2
|
22
|
SetEnv gambio_mod_env_working 1
|
23
|
</IfModule>
|
24
|
|
25
|
<IfModule !mod_env.c>
|
26
|
<IfModule mod_setenvif.c>
|
27
|
SetEnvIf ENV ^(.*)$ gambio_htaccessVersion=3.2
|
28
|
SetEnvIf ENV ^(.*)$ gambio_mod_envif_working=1
|
29
|
</IfModule>
|
30
|
</IfModule>
|
31
|
|
32
|
# -----------------------------------------------------------------------------
|
33
|
# Disable ETags for Performance
|
34
|
# -----------------------------------------------------------------------------
|
35
|
|
36
|
<IfModule mod_headers.c>
|
37
|
|
38
|
<IfModule mod_env.c>
|
39
|
SetEnv gambio_mod_headers_working 1
|
40
|
</IfModule>
|
41
|
|
42
|
<IfModule !mod_env.c>
|
43
|
<IfModule mod_setenvif.c>
|
44
|
SetEnvIf ENV ^(.*)$ gambio_mod_headers_working=1
|
45
|
</IfModule>
|
46
|
</IfModule>
|
47
|
|
48
|
Header unset ETag
|
49
|
|
50
|
</IfModule>
|
51
|
|
52
|
# `FileETag None` doesn't work in all cases.
|
53
|
|
54
|
FileETag None
|
55
|
|
56
|
# -----------------------------------------------------------------------------
|
57
|
# Set Default Encoding for static HTML Files, JSON and friends to standards
|
58
|
# -----------------------------------------------------------------------------
|
59
|
|
60
|
AddDefaultCharset UTF-8
|
61
|
|
62
|
<IfModule mod_mime.c>
|
63
|
|
64
|
<IfModule mod_env.c>
|
65
|
SetEnv gambio_mod_mime_working 1
|
66
|
</IfModule>
|
67
|
|
68
|
<IfModule !mod_env.c>
|
69
|
<IfModule mod_setenvif.c>
|
70
|
SetEnvIf ENV ^(.*)$ gambio_mod_mime_working=1
|
71
|
</IfModule>
|
72
|
</IfModule>
|
73
|
|
74
|
AddCharset utf-8 .atom \
|
75
|
.bbaw \
|
76
|
.geojson \
|
77
|
.json \
|
78
|
.jsonld \
|
79
|
.manifest \
|
80
|
.rdf \
|
81
|
.rss \
|
82
|
.topojson \
|
83
|
.vtt \
|
84
|
.webapp \
|
85
|
.webmanifest \
|
86
|
.xloc \
|
87
|
.xml
|
88
|
</IfModule>
|
89
|
|
90
|
# ----------------------------------------------------------------------
|
91
|
# MIME types |
|
92
|
# ----------------------------------------------------------------------
|
93
|
|
94
|
# There are quite some servers serving resources without the proper media types (f.k.a. MIME types)
|
95
|
# breaking security,caching,compression
|
96
|
|
97
|
<IfModule mod_mime.c>
|
98
|
|
99
|
# Data interchange
|
100
|
AddType application/atom+xml atom
|
101
|
AddType application/json json map topojson
|
102
|
AddType application/ld+json jsonld
|
103
|
AddType application/rss+xml rss
|
104
|
AddType application/vnd.geo+json geojson
|
105
|
AddType application/xml rdf xml
|
106
|
|
107
|
# JavaScript
|
108
|
AddType application/javascript js
|
109
|
|
110
|
# Manifest files
|
111
|
AddType application/manifest+json webmanifest
|
112
|
AddType application/x-web-app-manifest+json webapp
|
113
|
AddType text/cache-manifest appcache
|
114
|
|
115
|
# Media files
|
116
|
AddType audio/mp4 f4a f4b m4a
|
117
|
AddType audio/ogg oga ogg opus
|
118
|
AddType image/bmp bmp
|
119
|
AddType image/svg+xml svg svgz
|
120
|
AddType image/webp webp
|
121
|
AddType video/mp4 f4v f4p m4v mp4
|
122
|
AddType video/ogg ogv
|
123
|
AddType video/webm webm
|
124
|
AddType video/x-flv flv
|
125
|
AddType image/x-icon cur ico
|
126
|
|
127
|
# Web fonts
|
128
|
AddType application/font-woff woff
|
129
|
AddType application/font-woff2 woff2
|
130
|
AddType application/vnd.ms-fontobject eot
|
131
|
AddType application/x-font-ttf ttc ttf
|
132
|
AddType font/opentype otf
|
133
|
|
134
|
# Other
|
135
|
AddType application/octet-stream safariextz
|
136
|
AddType application/x-bb-appworld bbaw
|
137
|
AddType application/x-chrome-extension crx
|
138
|
AddType application/x-opera-extension oex
|
139
|
AddType application/x-xpinstall xpi
|
140
|
AddType text/vcard vcard vcf
|
141
|
AddType text/vnd.rim.location.xloc xloc
|
142
|
AddType text/vtt vtt
|
143
|
AddType text/x-component htc
|
144
|
|
145
|
</IfModule>
|
146
|
|
147
|
# -----------------------------------------------------------------------------
|
148
|
# Compression
|
149
|
# -----------------------------------------------------------------------------
|
150
|
|
151
|
<IfModule mod_deflate.c>
|
152
|
|
153
|
<IfModule mod_env.c>
|
154
|
SetEnv gambio_mod_deflate_working 1
|
155
|
</IfModule>
|
156
|
|
157
|
<IfModule !mod_env.c>
|
158
|
<IfModule mod_setenvif.c>
|
159
|
SetEnvIf ENV ^(.*)$ gambio_mod_deflate_working=1
|
160
|
</IfModule>
|
161
|
</IfModule>
|
162
|
|
163
|
<IfModule mod_headers.c>
|
164
|
SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
|
165
|
RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
|
166
|
</IfModule>
|
167
|
|
168
|
<IfModule mod_filter.c>
|
169
|
|
170
|
<IfModule mod_env.c>
|
171
|
SetEnv gambio_mod_filter_working 1
|
172
|
</IfModule>
|
173
|
|
174
|
<IfModule !mod_env.c>
|
175
|
<IfModule mod_setenvif.c>
|
176
|
SetEnvIf ENV ^(.*)$ gambio_mod_filter_working=1
|
177
|
</IfModule>
|
178
|
</IfModule>
|
179
|
|
180
|
AddOutputFilterByType DEFLATE "application/atom+xml" \
|
181
|
"application/javascript" \
|
182
|
"application/json" \
|
183
|
"application/ld+json" \
|
184
|
"application/manifest+json" \
|
185
|
"application/rdf+xml" \
|
186
|
"application/rss+xml" \
|
187
|
"application/schema+json" \
|
188
|
"application/vnd.geo+json" \
|
189
|
"application/vnd.ms-fontobject" \
|
190
|
"application/x-font-ttf" \
|
191
|
"application/x-javascript" \
|
192
|
"application/x-web-app-manifest+json" \
|
193
|
"application/xhtml+xml" \
|
194
|
"application/xml" \
|
195
|
"font/eot" \
|
196
|
"font/opentype" \
|
197
|
"image/bmp" \
|
198
|
"image/svg+xml" \
|
199
|
"image/vnd.microsoft.icon" \
|
200
|
"image/x-icon" \
|
201
|
"text/cache-manifest" \
|
202
|
"text/css" \
|
203
|
"text/html" \
|
204
|
"text/javascript" \
|
205
|
"text/plain" \
|
206
|
"text/vcard" \
|
207
|
"text/vnd.rim.location.xloc" \
|
208
|
"text/vtt" \
|
209
|
"text/x-component" \
|
210
|
"text/x-cross-domain-policy" \
|
211
|
"text/xml"
|
212
|
</IfModule>
|
213
|
|
214
|
<IfModule mod_mime.c>
|
215
|
AddEncoding gzip svgz
|
216
|
</IfModule>
|
217
|
|
218
|
</IfModule>
|
219
|
|
220
|
# -----------------------------------------------------------------------------
|
221
|
# Caching
|
222
|
# -----------------------------------------------------------------------------
|
223
|
|
224
|
<IfModule mod_expires.c>
|
225
|
|
226
|
<IfModule mod_env.c>
|
227
|
SetEnv gambio_mod_expires_working 1
|
228
|
</IfModule>
|
229
|
|
230
|
<IfModule !mod_env.c>
|
231
|
<IfModule mod_setenvif.c>
|
232
|
SetEnvIf ENV ^(.*)$ gambio_mod_expires_working=1
|
233
|
</IfModule>
|
234
|
</IfModule>
|
235
|
|
236
|
ExpiresActive On
|
237
|
|
238
|
# -----------------------------------------------------------------------------
|
239
|
# Really cache anything
|
240
|
# -----------------------------------------------------------------------------
|
241
|
|
242
|
ExpiresDefault "access plus 1 month"
|
243
|
|
244
|
# -----------------------------------------------------------------------------
|
245
|
# Definitons for tweakers
|
246
|
# -----------------------------------------------------------------------------
|
247
|
|
248
|
# CSS
|
249
|
ExpiresByType text/css "access plus 1 month"
|
250
|
|
251
|
# Favicon (cannot be renamed!) and cursor images
|
252
|
ExpiresByType image/vnd.microsoft.icon "access plus 1 month"
|
253
|
ExpiresByType image/x-icon "access plus 1 month"
|
254
|
|
255
|
# Media files
|
256
|
ExpiresByType audio/ogg "access plus 1 month"
|
257
|
ExpiresByType image/bmp "access plus 1 month"
|
258
|
ExpiresByType image/gif "access plus 1 month"
|
259
|
ExpiresByType image/jpeg "access plus 1 month"
|
260
|
ExpiresByType image/png "access plus 1 month"
|
261
|
ExpiresByType image/svg+xml "access plus 1 month"
|
262
|
ExpiresByType image/webp "access plus 1 month"
|
263
|
ExpiresByType video/mp4 "access plus 1 month"
|
264
|
ExpiresByType video/ogg "access plus 1 month"
|
265
|
ExpiresByType video/webm "access plus 1 month"
|
266
|
|
267
|
# Web fonts
|
268
|
ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
|
269
|
ExpiresByType font/eot "access plus 1 month"
|
270
|
ExpiresByType font/opentype "access plus 1 month"
|
271
|
ExpiresByType application/x-font-ttf "access plus 1 month"
|
272
|
ExpiresByType application/font-woff "access plus 1 month"
|
273
|
ExpiresByType application/x-font-woff "access plus 1 month"
|
274
|
ExpiresByType font/woff "access plus 1 month"
|
275
|
ExpiresByType application/font-woff2 "access plus 1 month"
|
276
|
|
277
|
# JavaScript
|
278
|
ExpiresByType application/javascript "access plus 1 month"
|
279
|
ExpiresByType application/x-javascript "access plus 1 month"
|
280
|
ExpiresByType text/javascript "access plus 1 month"
|
281
|
|
282
|
# -----------------------------------------------------------------------------
|
283
|
# Exclude these mimetypes from caching, these always need to be current
|
284
|
# -----------------------------------------------------------------------------
|
285
|
|
286
|
# XML Files like the Sitemap
|
287
|
ExpiresByType application/xml "access plus 0 seconds"
|
288
|
|
289
|
# Styleedit Output, Statistics, Shopintercommunication, API Output
|
290
|
ExpiresByType application/json "access plus 0 seconds"
|
291
|
|
292
|
# All kinds of exports
|
293
|
ExpiresByType text/csv "access plus 0 seconds"
|
294
|
|
295
|
</IfModule>
|
296
|
|
297
|
# -----------------------------------------------------------------------------
|
298
|
# Security
|
299
|
# -----------------------------------------------------------------------------
|
300
|
|
301
|
<ifModule mod_headers.c>
|
302
|
|
303
|
Header set X-Content-Type-Options: nosniff
|
304
|
|
305
|
</ifModule>
|
306
|
|
307
|
## Disable index listing for all folders
|
308
|
Options -Indexes
|
309
|
|
310
|
# -----------------------------------------------------------------------------
|
311
|
# Rewrites: SEOBoost, Security + Image Processing on the fly
|
312
|
# -----------------------------------------------------------------------------
|
313
|
|
314
|
<IfModule mod_rewrite.c>
|
315
|
|
316
|
<IfModule mod_env.c>
|
317
|
SetEnv gambio_mod_rewrite_working 1
|
318
|
</IfModule>
|
319
|
|
320
|
<IfModule !mod_env.c>
|
321
|
<IfModule mod_setenvif.c>
|
322
|
SetEnvIf ENV ^(.*)$ gambio_mod_rewrite_working=1
|
323
|
</IfModule>
|
324
|
</IfModule>
|
325
|
|
326
|
RewriteEngine on
|
327
|
|
328
|
##some Hosters like 1&1 need the following line to be enabled, else all the following will fail all the time
|
329
|
|
330
|
RewriteBase /
|
331
|
|
332
|
# -----------------------------------------------------------------------------
|
333
|
# Dynamically detect Rewritebase and URI part past Rewritebase
|
334
|
# -----------------------------------------------------------------------------
|
335
|
|
336
|
RewriteCond %{REQUEST_URI}::$1 ^(.*?/)(.*)::\2$
|
337
|
RewriteRule ^(.*)$ - [E=SUFFIX:%2]
|
338
|
|
339
|
RewriteCond %{REQUEST_URI}::$1 ^(.*?/)(.*)::\2$
|
340
|
RewriteRule ^(.*)$ - [E=BASE:%1]
|
341
|
|
342
|
# -----------------------------------------------------------------------------
|
343
|
# Passthrough of HTTP Auth Headers to PHP on Hosts using PHP FPM/FCGI
|
344
|
# -----------------------------------------------------------------------------
|
345
|
|
346
|
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
347
|
|
348
|
# -----------------------------------------------------------------------------
|
349
|
# Security: Deny direct access to important system folders
|
350
|
# -----------------------------------------------------------------------------
|
351
|
|
352
|
## we don't distribute a git config ourselves but we saw users doing it,
|
353
|
## which is a really bad idea. Let's protect it.
|
354
|
RewriteCond %{ENV:SUFFIX} ^.git/.* [or]
|
355
|
|
356
|
## protect system folders
|
357
|
RewriteCond %{ENV:SUFFIX} ^admin/backups/.* [or]
|
358
|
RewriteCond %{ENV:SUFFIX} ^cache/.* [or]
|
359
|
RewriteCond %{ENV:SUFFIX} ^debug/.* [or]
|
360
|
RewriteCond %{ENV:SUFFIX} ^download/.* [or]
|
361
|
RewriteCond %{ENV:SUFFIX} ^export/inventory/.* [or]
|
362
|
RewriteCond %{ENV:SUFFIX} ^export/invoice/.* [or]
|
363
|
RewriteCond %{ENV:SUFFIX} ^export/packsingslip/.* [or]
|
364
|
RewriteCond %{ENV:SUFFIX} ^export/sepa/.* [or]
|
365
|
RewriteCond %{ENV:SUFFIX} ^gambio_updater/updates/.* [or]
|
366
|
RewriteCond %{ENV:SUFFIX} ^gm/customer_uploads/.* [or]
|
367
|
RewriteCond %{ENV:SUFFIX} ^GProtector/.* [or]
|
368
|
RewriteCond %{ENV:SUFFIX} ^GXEngine/.* [or]
|
369
|
RewriteCond %{ENV:SUFFIX} ^GXMainComponents/.* [or]
|
370
|
RewriteCond %{ENV:SUFFIX} ^includes/.* [or]
|
371
|
RewriteCond %{ENV:SUFFIX} ^logfiles/.* [or]
|
372
|
RewriteCond %{ENV:SUFFIX} ^templates_c/.* [or]
|
373
|
RewriteCond %{ENV:SUFFIX} ^uploads/.* [or]
|
374
|
RewriteCond %{ENV:SUFFIX} ^version_info/.*
|
375
|
RewriteRule ^(.*)$ - [R=403,L]
|
376
|
|
377
|
# -----------------------------------------------------------------------------
|
378
|
# Cache busting
|
379
|
# -----------------------------------------------------------------------------
|
380
|
|
381
|
RewriteCond %{ENV:SUFFIX} .*-bust_.*(\.(min\.)?(js|css\.php|css))
|
382
|
RewriteRule ^(.*)(-bust_[0-9a-f]+)(\.(min\.)?(js|css\.php|css))$ %{ENV:BASE}$1$3 [L,QSA]
|
383
|
|
384
|
# -----------------------------------------------------------------------------
|
385
|
# Image Processing on the fly
|
386
|
# -----------------------------------------------------------------------------
|
387
|
|
388
|
## if request destination is a product image and size not bigger than 0 try to create the sized image
|
389
|
RewriteCond %{REQUEST_FILENAME} ".*?\/images\/product_images\/.*\.(?:gif|jpe?g|png)$" [NC]
|
390
|
RewriteCond %{REQUEST_FILENAME} !-s
|
391
|
RewriteRule (\.gif|\.jpe?g|\.png)$ %{ENV:BASE}shop.php?do=ImageRequest [L,NC]
|
392
|
|
393
|
# -----------------------------------------------------------------------------
|
394
|
# Put your own Redirects and Rewrites here - Start
|
395
|
# -----------------------------------------------------------------------------
|
396
|
|
397
|
## Example Redirects
|
398
|
|
399
|
## Example for category
|
400
|
#RewriteCond %{REQUEST_URI} old-category
|
401
|
#RewriteRule ^(.*)$ https://www.shop.com/new-category [L,R=301]
|
402
|
|
403
|
## Example for product
|
404
|
#RewriteCond %{REQUEST_URI} old-category/old-product.html
|
405
|
#RewriteRule ^(.*)$ https://www.shop.com/new-category/new-product-html [L,R=301]
|
406
|
|
407
|
## If you need GET parameters to be passed on, add QSA to flags like this
|
408
|
## Hint: most of the time this is a bad idea
|
409
|
#RewriteCond %{REQUEST_URI} old-category/old-product.html
|
410
|
#RewriteRule ^(.*)$ https://www.shop.com/new-category/new-product-html [QSA,L,R=301]
|
411
|
|
412
|
# -----------------------------------------------------------------------------
|
413
|
# Put your own Redirects and Rewrites here - End
|
414
|
# -----------------------------------------------------------------------------
|
415
|
|
416
|
# -----------------------------------------------------------------------------
|
417
|
# Gambio SEO Boost URLs
|
418
|
# -----------------------------------------------------------------------------
|
419
|
|
420
|
## if request destination is any of these filetypes or located in any of these folders stop processing rewrite
|
421
|
RewriteCond %{REQUEST_FILENAME} ^(.*)\.(php|css|js|gif|ico|jpe?g|png)$ [NC,or]
|
422
|
RewriteCond %{REQUEST_URI} .*?\/(?:admin|images|public|templates|themes)\/.
|
423
|
RewriteRule ^(.+) - [L]
|
424
|
|
425
|
## if request destination is an existing directory, file or link stop processing rewrite
|
426
|
RewriteCond %{REQUEST_FILENAME} -d [or]
|
427
|
RewriteCond %{REQUEST_FILENAME} -f [or]
|
428
|
RewriteCond %{REQUEST_FILENAME} -l
|
429
|
RewriteRule ^(.+) - [L]
|
430
|
|
431
|
#if request destination is a php file in root dir and language code in url is present lets go there
|
432
|
RewriteRule ^[a-z]{2}/([A-Za-z0-9_/-]+)\.php.* %{ENV:BASE}$1.php?%{QUERY_STRING} [PT,L]
|
433
|
|
434
|
##If all of these conditions didn't stop us, lets rewrite
|
435
|
|
436
|
##boosted CONTENT
|
437
|
RewriteRule (^[A-Za-z]{2}/){0,1}(.*/)?info/([A-Za-z0-9_/-]+)\.html.* %{ENV:BASE}shop_content.php?gm_boosted_content=$3&%{QUERY_STRING} [PT,L]
|
438
|
RewriteRule (^[A-Za-z]{2}/){0,1}(.*/)?popup/([A-Za-z0-9_/-]+)\.html.* %{ENV:BASE}popup_content.php?gm_boosted_content=$3&%{QUERY_STRING} [PT,L]
|
439
|
|
440
|
##boosted PRODUCTS
|
441
|
RewriteRule (^[A-Za-z]{2}/){0,1}([A-Za-z0-9_/-]+)\.html %{ENV:BASE}product_info.php?gm_boosted_product=$2&%{QUERY_STRING} [PT,L]
|
442
|
|
443
|
##boosted CATEGORIES
|
444
|
RewriteRule (^[A-Za-z]{2}/){0,1}([A-Za-z0-9_\/-]*)(\?*.*|\z) %{ENV:BASE}index.php?gm_boosted_category=$2&%{QUERY_STRING} [L]
|
445
|
|
446
|
</IfModule>
|