Загрузка страницы..
Additional file-types for mod_expires
Эти заголовки указывают, в течение какого периода браузер может использовать кешированные ресурсы, не запрашивая на веб-сервере их возможные обновления.
2017-03-13T16:03 13 марта 2017 16:03
Просмотров: 580

Ниже приведен список из наиболее распространенных типов файлов для веб - сервера Apache mod_expires, который используется для настройки заголовка для лучшего управления кэшем.

<IfModule mod_expires.c>

	ExpiresActive on
	ExpiresDefault                                    "access plus 1 month"
	
	# DATA
	ExpiresByType text/xml                            "access plus 0 seconds"
	ExpiresByType text/html                           "access plus 0 seconds"
	ExpiresByType text/plain                          "access plus 0 seconds"
	ExpiresByType application/xml                     "access plus 0 seconds"
	ExpiresByType application/json                    "access plus 0 seconds"
	ExpiresByType application/rss+xml                 "access plus 1 hour"
	ExpiresByType application/atom+xml                "access plus 1 hour"
	ExpiresByType text/x-component                    "access plus 1 hour"
	
	# MANIFEST
	ExpiresByType application/x-web-app-manifest+json "access plus 0 seconds"
	ExpiresByType text/cache-manifest                 "access plus 0 seconds"
	
	# SCRIPTS
	ExpiresByType text/css                            "access plus 1 month" 
	ExpiresByType text/javascript                     "access plus 1 month" 
	ExpiresByType application/javascript              "access plus 1 month" 
	ExpiresByType application/x-javascript            "access plus 1 month" 
	
	# IMAGES
	ExpiresByType image/gif                           "access plus 1 month"
	ExpiresByType image/png                           "access plus 1 month"
	ExpiresByType image/jpe                           "access plus 1 month"
	ExpiresByType image/jpg                           "access plus 1 month"
	ExpiresByType image/jpeg                          "access plus 1 month"
	ExpiresByType image/jp2                           "access plus 1 month"
	ExpiresByType image/pipeg                         "access plus 1 month"
	ExpiresByType image/bmp                           "access plus 1 month"
	ExpiresByType image/tiff                          "access plus 1 month"
	ExpiresByType image/svg+xml                       "access plus 1 month"
	ExpiresByType image/vnd.microsoft.icon            "access plus 1 month"
	
	# ICONS
	ExpiresByType image/ico                           "access plus 1 month"
	ExpiresByType image/icon                          "access plus 1 month"
	ExpiresByType text/ico                            "access plus 1 month"
	ExpiresByType image/x-ico                         "access plus 1 month"
	ExpiresByType image/x-icon                        "access plus 1 month"
	ExpiresByType application/ico                     "access plus 1 month"
	
	# AUDIO
	ExpiresByType audio/ogg                           "access plus 1 month"
	ExpiresByType audio/basic                         "access plus 1 month"
	ExpiresByType audio/mid                           "access plus 1 month"
	ExpiresByType audio/midi                          "access plus 1 month"
	ExpiresByType audio/mpeg                          "access plus 1 month"
	ExpiresByType audio/x-aiff                        "access plus 1 month"
	ExpiresByType audio/x-mpegurl                     "access plus 1 month"
	ExpiresByType audio/x-pn-realaudio                "access plus 1 month"
	ExpiresByType audio/x-wav                         "access plus 1 month"
	
	# VIDEO
	ExpiresByType video/ogg                           "access plus 1 month"
	ExpiresByType video/mp4                           "access plus 1 month"
	ExpiresByType video/webm                          "access plus 1 month"
	ExpiresByType video/x-msvideo                     "access plus 1 month"
	ExpiresByType video/mpeg                          "access plus 1 month"
	ExpiresByType video/quicktime                     "access plus 1 month"
	ExpiresByType video/x-la-asf                      "access plus 1 month"
	ExpiresByType video/x-ms-asf                      "access plus 1 month"
	ExpiresByType x-world/x-vrml                      "access plus 1 month"
	
	# FONTS
	ExpiresByType font/truetype                       "access plus 1 month"
	ExpiresByType font/opentype                       "access plus 1 month"
	ExpiresByType application/x-font-ttf              "access plus 1 month"
	ExpiresByType application/x-font-woff             "access plus 1 month"
	ExpiresByType application/font-woff               "access plus 1 month"
	ExpiresByType application/vnd.ms-fontobject       "access plus 1 month"
	
	# FLASH
	ExpiresByType application/x-shockwave-flash       "access plus 1 month"
	ExpiresByType video/x-flv                         "access plus 1 month"
	
	# OTHERS
	ExpiresByType application/pdf                     "access plus 1 month"
	ExpiresByType image/vnd.wap.wbmp                  "access plus 1 month"
	ExpiresByType application/vnd.wap.wbxml           "access plus 1 month"
	ExpiresByType application/smil                    "access plus 1 month"
	
	<IfModule mod_headers.c>
		Header append Cache-Control "public"
	</IfModule>
	
</IfModule>

Примечание: вместо того , чтобы писать "access plus 1 month", вы можете написать " now plus 1 month", это экономит несколько байт: D



Комментарии: 1

комментарий Dima
Dima
2017-03-18T01:5618 марта 2017 01:56
Спасибо! На всякий случай везде поставил 1 year. PageSpeed больше не ругается :)

Добавить комментарий

Яндекс.Метрика Яндекс.Метрик