The reason for Leverage Browser Caching showing only 5 Minute cache time issue could be due to the fact that you are using Mod_Pagespeed module.
A little background: mod_pagespeed extends the cache lifetime of resources and adds a unique hash code to the resource name to improve user cacheability and thus speed up the page load for returning users.
As you’ve pointed out there are two distinct cache lifetimes that are important to mod_pagespeed.
(T.1) is the cache lifetime mod_pagespeed sets. It is currently set to 1 year and I don’t think it is customizable. But since we add in the unique hash code to the URL, you should not need to customize this in most cases. As soon as mod_pagespeed realizes that the resource has changed, it will put a different URL into the HTML file and thus update the user caches.
(T.2) is the original cache lifetime of the resource (by default 5 minutes). mod_pagespeed reloads the file whenever it expires, and thus you see that 3-4 minute lag. There are a couple different ways you can improve this. The best is if the files are completely static, you can use ModPagespeedLoadFromFile. When you use that directive, mod_pagespeed will check the file every time it rewrites HTML, meaning the resource will be updated instantly. If you cannot use LoadFromFile, you can explicitly set shorter cache lifetimes for your resources in Apache. For example:
ExpiresByType image/gif "modification plus 3 minutes"
ExpiresByType text/css "modification plus 1 minute"
ExpiresByType text/css "modification plus 5 minutes"
However, note that if you reduce this time, you will make mod_pagespeed request the resource more often (every 1 minute for CSS files in foo/ directory above) and can put more load on your server unnecessarily. Another solution is to clear mod_pagespeed cache during development. This can allow you to update the server quickly when developing, but not make your server unnecessarily burdened the rest of the time.
“If you want to modify the default cache time, you can do so with the following directive:
pagespeed ImplicitCacheTtlMs 2629746000;
The time is set in milliseconds. Those directives should be set in the “Advanced” settings for the domain you want to change it to.”
If Font/ Social Icons goes missing after adding MAXCDN cdn you need to check the option to serve those file as well in CDN
Cdn will not change origin of fonts unless you check that option in cdn settings.
If after changing site address and WordPress url address you get locked out of the WordPress login then all you need to do is:
- Go to phpMyAdmin
- Select your Database
- Search for Table wpgg_options
- Select and click the wpgg_options table
- Row under “option_name” column marked with a) siteurl b) home needs to be update with original url.
- Click edit and update the url
- Click Go to save.
- Repeat for home row as well.
If enable keep-alive is not working then you have two options.
- htaccess: add the following line of code in .htaccess file
<ifModule mod_headers.c> Header set Connection keep-alive </ifModule>
2. if that does not resolved it mean the issue is with the hosting provider and you need to contact them and ask them to switch from closed connection type to enable keep-alive type.
Using PHP you can combine & minify all of your CSS files to reduces overall filesize and minimizes HTTP requests.
function compress( $minify )
/* remove comments */
$minify = preg_replace( '!/*[^*]**+([^/][^*]**+)*/!', '', $minify );
/* remove tabs, spaces, newlines, etc. */
$minify = str_replace( array("rn", "r", "n", "t", ' ', ' ', ' '), '', $minify );
/* css files for combining */
Create a file with the code above and save it as minified.css.php, then simply link to that file as you would normally for your CSS file:
<link href="assets/css/minified.css.php" rel="stylesheet">
All the CSS files you reference inside the script will be combined & minified at run time.
To optimize Web Font Optimization – Compress, opentype .otf, eot .eot, truetype .ttf, & woff fonttype using gzip or deflate compression you need to add the following code in .htaccess file
Addtype font/opentype .otf
Addtype font/eot .eot
Addtype font/truetype .ttf
AddType application/x-font-woff .woff
AddOutputFilterByType DEFLATE font/opentype font/truetype font/eot
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/plain
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
# Leverage Browser Caching
ExpiresByType image/jpg “access 1 year”
ExpiresByType image/jpeg “access 1 year”
ExpiresByType image/gif “access 1 year”
ExpiresByType image/png “access 1 year”
ExpiresByType text/css “access 1 month”
ExpiresByType text/html “access 1 month”
ExpiresByType application/pdf “access 1 month”
ExpiresByType application/x-shockwave-flash “access 1 month”
ExpiresByType image/x-icon “access 1 year”
ExpiresDefault “access 1 month”
Header set Cache-Control “max-age=2678400, public”
Header set Cache-Control “max-age=7200, private, must-revalidate”
Header set Cache-Control “max-age=86400, public”
Header set Cache-Control “max-age=2678400, private”
woff font type gzip
ttf font zip