forked from tbelliard/gepi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.htaccess
executable file
·91 lines (76 loc) · 3.54 KB
/
.htaccess
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
AddType application/octet-stream .sql
AddType application/octet-stream .csv
# Protect files and directories from prying eyes.
#<FilesMatch "\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl|xml)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$">
<FilesMatch "\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$">
Order allow,deny
deny from all
</FilesMatch>
<IfModule headers_module>
# cache images for 1 month, do not require revalidation
<FilesMatch "\.(gif|jpe?g|png|flv|swf|ico)$">
Header set Cache-Control: "max-age=1296000"
</FilesMatch>
#
# cache scripts, css for 1 week, do not require revalidation
<FilesMatch "\.(js|css)$">
Header set Cache-Control: "max-age=604800"
</FilesMatch>
#
# Cache txt, html, and htm pages for 1 week, require revalidation
<FilesMatch "\.(txt|html?)$">
Header set Cache-Control: "max-age=604800, must-revalidate"
</FilesMatch>
#
# disable caching for dynamic files
<FilesMatch "\.(pl|php|[sf]?cgi|spl|pdf)$">
Header set Cache-Control: "max-age=0, no-store"
</FilesMatch>
</IfModule>
DirectoryIndex login.php index.html index.htm index.php
<IfModule rewrite_module>
RewriteEngine On
# Block access to "hidden" directories whose names begin with a period. This
# includes directories used by version control systems such as Subversion or
# Git to store control files. Files whose names begin with a period, as well
# as the control files used by CVS, are protected by the FilesMatch directive
# above.
#
# NOTE: This only works when mod_rewrite is loaded. Without mod_rewrite, it is
# not possible to block access to entire directories from .htaccess, because
# <DirectoryMatch> is not allowed here.
#
# If you do not have mod_rewrite installed, you should remove these
# directories from your webroot or otherwise protect them from being
# downloaded.
RewriteRule "(^|/)\." - [F]
# Authentification dans le cas de PHP en mode CGI
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
# acces simplesaml forcé en https.
RewriteCond %{HTTPS} off
RewriteRule ^simplesaml(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [NE,L,R] # redirige en https pour l'authentification
RewriteCond %{HTTPS} off
RewriteRule ^lib/simplesaml(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [NE,L,R] # redirige en https pour l'authentification
# fin forcage https
# redirection simplesaml
RewriteRule ^simplesaml(.*)$ lib/simplesaml/www$1
<IfModule mod_headers.c>
# Serve gzip compressed CSS files if they exist and the client accepts gzip.
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{REQUEST_FILENAME}\.gz -s
RewriteRule ^(.*)\.css $1\.css\.gz [QSA]
# Serve gzip compressed JS files if they exist and the client accepts gzip.
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{REQUEST_FILENAME}\.gz -s
RewriteRule ^(.*)\.js $1\.js\.gz [QSA]
# Serve correct content types, and prevent mod_deflate double gzip.
RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1]
RewriteRule \.js\.gz$ - [T=text/javascript,E=no-gzip:1]
<FilesMatch "(\.js\.gz|\.css\.gz)$">
# Serve correct encoding type.
Header append Content-Encoding gzip
# Force proxies to cache gzipped & non-gzipped css/js files separately.
Header append Vary Accept-Encoding
</FilesMatch>
</IfModule>
</IfModule>