muhammad riza 6 лет назад
Родитель
Сommit
87c757ecda
1 измененных файлов: 27 добавлений и 37 удалений
  1. 27
    37
      .htaccess

+ 27
- 37
.htaccess Просмотреть файл

@@ -6,34 +6,35 @@ RewriteEngine On
6 6
     # If the requested resource doesn't exist, use index.html
7 7
 RewriteRule ^ /index.html
8 8
 
9
-<IfModule mod_headers.c>
10
-  <FilesMatch "\.(ttf|ttc|otf|eot|woff|woff2|font.css|css|js)$">
11
-    Header set Access-Control-Allow-Origin "*"
12
-  </FilesMatch>
13
-</IfModule>
9
+<IfModule mod_expires.c>
10
+	ExpiresActive On
14 11
 
15
-<FilesMatch "\.(css|js)$">
16
-	<IfModule mod_expires.c>
17
-		ExpiresActive On
12
+	# Images
13
+	ExpiresByType image/jpeg "access plus 1 year"
14
+	ExpiresByType image/gif "access plus 1 year"
15
+	ExpiresByType image/png "access plus 1 year"
16
+	ExpiresByType image/webp "access plus 1 year"
17
+	ExpiresByType image/svg+xml "access plus 1 year"
18
+	ExpiresByType image/x-icon "access plus 1 year"
18 19
 
19
-		# Images
20
-		ExpiresByType image/jpeg "access plus 1 year"
21
-		ExpiresByType image/gif "access plus 1 year"
22
-		ExpiresByType image/png "access plus 1 year"
23
-		ExpiresByType image/webp "access plus 1 year"
24
-		ExpiresByType image/svg+xml "access plus 1 year"
25
-		ExpiresByType image/x-icon "access plus 1 year"
20
+	# Video
21
+	ExpiresByType video/mp4 "access plus 1 year"
22
+	ExpiresByType video/mpeg "access plus 1 year"
26 23
 
27
-		# Video
28
-		ExpiresByType video/mp4 "access plus 1 year"
29
-		ExpiresByType video/mpeg "access plus 1 year"
24
+	# CSS, JavaScript
25
+	ExpiresByType text/css "access plus 1 month"
26
+	ExpiresByType text/javascript "access plus 1 month"
27
+	ExpiresByType application/javascript "access plus 1 month"
28
+</IfModule>
30 29
 
31
-		# CSS, JavaScript
32
-		ExpiresByType text/css "access plus 1 month"
33
-		ExpiresByType text/javascript "access plus 1 month"
34
-		ExpiresByType application/javascript "access plus 1 month"
35
-	</IfModule>
36
-	<IfModule mod_headers.c>
30
+<IfModule mod_headers.c>
31
+	<FilesMatch "\.(ttf|ttc|otf|eot|woff|woff2|font.css|css|js)$">
32
+		Header set Access-Control-Allow-Origin "*"
33
+	</FilesMatch>
34
+	<FilesMatch "\.(ico|pdf|flv|swf|gif|png|jpg|jpeg|txt|html|htm)$">
35
+		Header set Cache-Control "max-age=2592000, public"
36
+	</FilesMatch>
37
+	<FilesMatch "\.(css|js)$">
37 38
 		FileETag None
38 39
 		Header unset ETag
39 40
 		Header unset Pragma
@@ -42,8 +43,8 @@ RewriteRule ^ /index.html
42 43
 		Header set Pragma "no-cache"
43 44
 		Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
44 45
 		Header set Expires "Thu, 1 Jan 1970 00:00:00 GMT"
45
-	</IfModule>
46
-</FilesMatch>
46
+	</FilesMatch>
47
+</IfModule>
47 48
 
48 49
 <IfModule mod_mime.c>
49 50
 	AddType application/x-javascript .js
@@ -63,17 +64,6 @@ RewriteRule ^ /index.html
63 64
 	</IfModule>
64 65
 </IfModule>
65 66
 
66
-<IfModule mod_gzip.c>
67
-  mod_gzip_on Yes
68
-  mod_gzip_dechunk Yes
69
-  mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
70
-  mod_gzip_item_include handler ^cgi-script$
71
-  mod_gzip_item_include mime ^text/.*
72
-  mod_gzip_item_include mime ^application/x-javascript.*
73
-  mod_gzip_item_exclude mime ^image/.*
74
-  mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
75
-</IfModule>
76
-
77 67
 <IfModule mod_headers.c>
78 68
     RewriteCond "%{HTTP:Accept-encoding}" "gzip"
79 69
     RewriteCond "%{REQUEST_FILENAME}\.gz" -s

Загрузка…
Отмена
Сохранить