mod-expires

Apache won't set headers for PHP script

痞子三分冷 提交于 2019-11-28 12:33:08
This .htaccess file: <IfModule mod_expires.c> ExpiresActive On ExpiresDefault "access plus 4 month" </IfModule> <IfModule mod_headers.c> Header merge X-ModHeaders "Yes, it is installed" </IfModule> ... works as expected in my development box (Windows box, Apache/2.4.10, PHP running as Apache module), where "works" means that it generates the appropriates headers for all resources (static or dynamic). However, in my production server (Linux box, Apache/2.2.31, PHP running as FastCGI with mod_fcgid/2.3.9) it only works for static assets, not for PHP scripts. Am I right suspecting that difference

Apache: set max-age or expires in .htaccess for directory

家住魔仙堡 提交于 2019-11-28 11:08:58
I have a handful of directories with content which will never change. Is it possible to create .htaccess file which tells the browser that anything in this directory and sub- directories can be cached for a very long time? I would like to copy the same .htaccess file in each directory if possible. If this is possible would you recommend max-age over expires or both? So it does look possible.... the .htaccess file syntax is: Header unset Last-Modified FileETag none ExpiresActive On ExpiresDefault "access plus 1 years" This will turn off Etags and turn on cache-control: max-age Then put this

PHP session_start() overwrites HTTP Expires header

只谈情不闲聊 提交于 2019-11-28 05:46:31
问题 I am trying to set Expire header to 2 hours from access for text/html by using mod_expires like that: <IfModule mod_expires.c> ExpiresActive on ExpiresDefault "access plus 2 hours" ExpiresByType text/html "access plus 2 hours" </IfModule> However when used with PHP: session_start(); Expires header is being reset to: Expires: Thu, 19 Nov 1981 08:52:00 GMT Any ideas how to avoid that overwrite by session_start() ? 回答1: OK, looks like have found an answer: session_cache_limiter('public');

Stop browser to make HTTP requests for images that should stay cached - mod_expires

我的未来我决定 提交于 2019-11-27 17:26:49
After reading many articles and some questions on here, I finally succeded in activating the Apache mod_expires to tell the browser it MUST cache images for 1 year . <filesMatch "\.(ico|gif|jpg|png)$"> ExpiresActive On ExpiresDefault "access plus 1 year" Header append Cache-Control "public" </filesMatch> And thankfully server responses seem to be correct: HTTP/1.1 200 OK Date: Fri, 06 Apr 2012 19:25:30 GMT Server: Apache Last-Modified: Tue, 26 Jul 2011 18:50:14 GMT Accept-Ranges: bytes Content-Length: 24884 Cache-Control: max-age=31536000, public Expires: Sat, 06 Apr 2013 19:25:30 GMT

Website image caching with Apache

五迷三道 提交于 2019-11-26 01:58:02
问题 How can I get static content on Apache to be {cached by browser} and not {checked for freshness {with every request}}? I\'m working on a website hosted on Apache webserver. Recently, I was testing something with headers (Content-Type for different types of content) and saw a lot of conditional requests for images. Example: 200 /index.php?page=1234&action=list 304 /favicon.ico 304 /img/logo.png 304 /img/arrow.png (etc.) Although the image files are static content and are cached by the browser,