-
-
Notifications
You must be signed in to change notification settings - Fork 61
/
Htaccess.html
executable file
路42 lines (39 loc) 路 1.36 KB
/
Htaccess.html
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
{escaping off}
{namespace sfc=SFC\Staticfilecache\ViewHelpers}
ForceType {contentType}
<sfc:format.stripEmptyVerticalSpaces>
<f:if condition="{sendCacheControlHeader}">
<IfModule mod_expires.c>
ExpiresActive on
ExpiresByType {contentType} {mode}{lifetime}
</IfModule>
</f:if>
<f:if condition="{sendCacheControlHeaderRedirectAfterCacheTimeout}">
<IfModule mod_rewrite.c>
RewriteEngine On
<f:comment>
Explicitly prevent direct access here. This is needed because the .htaccess
access check in the root dir is overwritten by the RewriteRules defined here.
</f:comment>
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule .* - [F,L]
RewriteCond %{TIME} ><f:format.date format="YmdHis">@{expires}</f:format.date>
RewriteRule ^.*$ /index.php
</IfModule>
</f:if>
<f:if condition="{headers}">
<IfModule mod_headers.c>
<f:for each="{headers}" key="name" as="value">
Header set {name} "{value}"
<f:if condition="{name} == 'Content-Security-Policy'">
<f:comment><!--
see https://httpd.apache.org/docs/2.4/mod/mod_headers.html
`%t` results in `t=[unixtime in microseconds]`, thus `&t=` needs to be stripped
--></f:comment>
Header edit Content-Security-Policy (@http-reporting\?csp=report&requestTime=)\d+ $1@t&%t
Header edit Content-Security-Policy (@http-reporting\?csp=report&requestTime=)@t&t=(\d+) $1$2
</f:if>
</f:for>
</IfModule>
</f:if>
</sfc:format.stripEmptyVerticalSpaces>