Apache - Google - Leverage browser caching via htaccess

Материал из Wiki - Iphoster - the best ever hosting and support. 2005 - 2023
Перейти к:навигация, поиск
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Самые выгодные сервера‎ в рунете


Apache - Google - Leverage browser caching via htaccess (Применяем кеширование браузера через htaccess)

Setting an expiry date or a maximum age in the HTTP headers for static resources instructs the browser to load previously downloaded resources from local disk rather than over the network.


Для Apache должен быть установлен:

# httpd -M  | grep expires
 expires_module (static)


Добавляем в .htaccess сайта:

<IfModule mod_expires.c>
       <filesmatch ".(jpg|jpeg|gif|png|ico|css|js)$">
      ExpiresActive on
       ExpiresDefault "access plus 1 month"
       </filesmatch>
</IfModule>


и проверяем тест в Google: