-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.htaccess
144 lines (115 loc) · 5.05 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
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
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.socialbase.com.br [NC]
RewriteRule ^(.*)$ https://socialbase.com.br/$1 [L,R=301]
################################################################
# Start Default Setting
################################################################
Options -Indexes -MultiViews +FollowSymlinks
AddDefaultCharset UTF-8
DefaultLanguage pt-BR
ServerSignature Off
FileETag none
AddType 'text/html; charset=UTF-8' .html
AddType application/x-font-woff2 .woff2
ErrorDocument 404 /404.php
################################################################
# Start RewriteEngine
################################################################
RewriteEngine on
################################################################
# Force HTTPS Redirect
################################################################
#RewriteCond %{HTTPS} off
#RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
################################################################
# Security Headers
################################################################
<IfModule mod_headers.c>
Header set X-XSS-Protection "1; mode=block"
#Header set X-Frame-Options "SAMEORIGIN"
Header set X-Content-Type-Options "nosniff"
Header set Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
Header set Referrer-Policy "same-origin"
Header set Feature-Policy "geolocation 'self'; vibrate 'none'"
</IfModule>
################################################################
# Força a utilizar Cache-Control e Expires header
################################################################
<IfModule mod_headers.c>
Header unset ETag
</IfModule>
<IfModule mod_headers.c>
<FilesMatch "\.(js|css|xml|gz|html)$">
Header append Vary: Accept-Encoding
</FilesMatch>
<filesMatch "\.(ico|jpg|jpeg|png|gif|svg|css|js|woff2)$">
Header set Cache-Control "max-age=31536000"
</filesMatch>
</IfModule>
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 2 days"
# Html
ExpiresByType text/html "access plus 0 seconds"
# Data
ExpiresByType text/xml "access plus 0 seconds"
ExpiresByType text/cache-manifest "access plus 0 seconds"
ExpiresByType application/xml "access plus 0 seconds"
ExpiresByType application/json "access plus 0 seconds"
# Feed
ExpiresByType application/rss+xml "access plus 1 hour"
ExpiresByType application/atom+xml "access plus 1 hour"
# Favicon
ExpiresByType image/x-icon "access plus 1 year"
#Media: images, ico
ExpiresByType image/gif "access plus 1 week"
ExpiresByType image/png "access plus 1 week"
ExpiresByType image/jpg "access plus 1 week"
ExpiresByType image/jpeg "access plus 1 week"
ExpiresByType image/webp "access plus 1 week"
ExpiresByType image/svg+xml "access plus 1 week"
# Video
ExpiresByType video/mp4 "access plus 1 week"
# Webfonts
ExpiresByType font/opentype "access plus 1 year"
ExpiresByType application/x-font-opentype "access plus 1 year"
ExpiresByType application/x-font-ttf "access plus 1 year"
ExpiresByType application/x-font-woff "access plus 1 year"
ExpiresByType application/font-woff "access plus 1 year"
ExpiresByType application/font-woff2 "access plus 1 year"
ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
# CSS/JS
ExpiresByType text/css "access plus 1 week"
ExpiresByType text/javascript "access plus 1 week"
ExpiresByType application/javascript "access plus 1 week"
ExpiresByType application/x-javascript "access plus 1 week"
</IfModule>
################################################################
# Força o IE a sempre carregar utilizando a última versão
################################################################
<IfModule mod_headers.c>
Header set X-UA-Compatible "IE=Edge,chrome=1"
<FilesMatch "\.(js|css|gif|png|bmp|jpg|jpeg|pdf|xml|oga|ogg|m4a|ogv|mp4|m4v|webm|svg|svgz|eot|ttf|otf|woff|ico|webp|appcache|manifest|htc|crx|oex|xpi|safariextz|vcf)$">
Header unset X-UA-Compatible
</FilesMatch>
</IfModule>
################################################################
# Comprimir arquivos do site para consumir menos banda
################################################################
<IfModule mod_deflate.c>
<FilesMatch "\.(html|htm|php|xml|js|css|svg|jpg|png|gif|ico)$">
<ifModule mod_filter.c>
SetOutputFilter DEFLATE
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css text/javascript image/x-icon image/svg+xml application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript
</IfModule>
</FilesMatch>
</IfModule>
################################################################
# Tratamento da URL
################################################################
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
RewriteCond %{REQUEST_METHOD} !POST [NC]
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /([^/]+/)*[^.#?\ ]+\.php([#?][^\ ]*)?\ HTTP/
RewriteRule ^(([^/]+/)*[^.]+)\.php /$1 [R=301,L]