mod-expires

Which one to use : Expire Header, Last Modified Header or ETags

久未见 提交于 2021-02-05 12:43:11
问题 I am running PHP on Apache, and am confused about how to implement server-side caching, in order to make the site load faster. What is the difference between the Expires , Last-Modified and ETag headers, and which one should be used in what situation? 回答1: You can use the Expires header in conjunction but regardless of the other two. It's universally supported by proxies and browser caches. The difference between ETag and Last-Modified stamps is more semantic. ETags are opaque to clients. It

Leverage Browser Caching js?ver=

别来无恙 提交于 2020-01-15 09:15:06
问题 I'm facing an odd problem with my Leverage Browser Caching. In my .htaccess I use the following: ## EXPIRES CACHING ## <IfModule mod_expires.c> ExpiresActive On ExpiresByType image/jpg "access plus 1 year" ExpiresByType image/jpeg "access plus 1 year" ExpiresByType image/gif "access plus 1 year" ExpiresByType image/png "access plus 1 year" ExpiresByType text/css "access plus 1 month" ExpiresByType application/pdf "access plus 1 month" ExpiresByType text/x-javascript "access plus 1 month"

massive Issue with Caching and ModExpire on php Files

a 夏天 提交于 2020-01-11 13:48:19
问题 I do have a massive Issue with Caching and ModExpire on php Files if i'am using following in my global .htaccess <IfModule mod_expires.c> ExpiresActive On ExpiresByType text/css "access plus 1 month" ExpiresByType text/javascript "access plus 1 month" ExpiresByType text/html "access plus 600 seconds" ExpiresByType application/javascript "access plus 1 month" ExpiresByType application/x-javascript "access plus 1 month" ExpiresByType application/xhtml-xml "access plus 600 seconds" ExpiresByType

yslow still not giving me an A for expires header in apache httpd even though I added them

浪子不回头ぞ 提交于 2020-01-03 05:53:09
问题 trying to add an ExpiresDefault ExpiresByType to content on my website so that way it is cached. I use cachebusting in the URL (a revision number in the path) for Javascript, CSS, and images so that way I can set it to forever for these mimetypes. I have the following rules set up in apache httpd: ExpiresActive On ExpiresDefault "access plus 1 minutes" ExpiresByType image/gif "access plus 10 years" ExpiresByType image/png "access plus 10 years" ExpiresByType image/jpeg "access plus 10 years"

Cache Expire Control with Last Modification

断了今生、忘了曾经 提交于 2019-12-20 09:18:38
问题 In Apache's mod_expires module, there is the Expires directive with two base time periods, access , and modification . ExpiresByType text/html "access plus 30 days" understandably means that the cache will request for fresh content after 30 days. However, ExpiresByType text/html "modification plus 2 hours" doesn't make intuitive sense. How does the browser cache know that the file has been modified unless it makes a request to the server? And if it is making a call to the server, what is the

Apache won't set headers for PHP script

柔情痞子 提交于 2019-12-17 20:25:36
问题 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

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

↘锁芯ラ 提交于 2019-12-17 19:39:50
问题 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? 回答1: So it does look possible.... the .htaccess file syntax is: Header unset Last-Modified FileETag none ExpiresActive On

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

放肆的年华 提交于 2019-12-17 15:34:14
问题 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

htaccess Disable cache if URL contains string?

与世无争的帅哥 提交于 2019-12-14 04:07:09
问题 Can I add exception to htaccess if URL contains "string"? Sth like: <if URL contains "string"> ExpiresDefault "access plus 1 days" </ifModule> ? My caching mod: <ifModule mod_expires.c> ExpiresActive On ExpiresByType image/gif "access plus 1 months" ExpiresByType image/jpg "access plus 1 months" ExpiresByType image/jpeg "access plus 1 months" ExpiresByType image/png "access plus 1 months" ExpiresByType image/vnd.microsoft.icon "access plus 1 months" ExpiresByType image/x-icon "access plus 1

Apache: How to add Expires headers to files without mod_expires installed

℡╲_俬逩灬. 提交于 2019-12-11 04:19:17
问题 I'm on a shared host running Apache. Apparently mod_expires is not installed. Is there another way to add expires headers to css-files, images etc. on that environment? 回答1: In your .htaccess (if that's an option) you can use a <FilesMatch> block with Header directives. This requires mod_headers , though, and I'm pretty sure that you can't specify a "rolling" expiration date (i.e., "one year from now"). Therefore, you'll need to edit this setting, say, once a year 1 . Also, did you see this