Leverage Browser Caching showing only 5 Minute cache time issue

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:

<Directory ".../foo/">
  ExpiresByType image/gif "modification plus 3 minutes"
  ExpiresByType text/css  "modification plus 1 minute"
<Directory ".../bar/">
  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.”


wordpress admin locked out after wordpress address and site address

If after changing site address and WordPress url address you get locked out of the WordPress login then all you need to do is:

  1. Go to phpMyAdmin
  2. Select your Database
  3. Search for Table wpgg_options
  4. Select and click the wpgg_options table
  5. Row under  “option_name” column  marked with a) siteurl b) home needs to be update with original url.
  6. Click edit and update the url
  7. Click Go to save.
  8. Repeat for home row as well.
  9. Done.
  10. redirection

WordPress Combine & Minify CSS using PHP

Using  PHP you can combine & minify all of your CSS files to reduces overall filesize and minimizes HTTP requests.

header('Content-type: text/css');

    function compress( $minify )
	/* remove comments */
    	$minify = preg_replace( '!/*[^*]**+([^/][^*]**+)*/!', '', $minify );

        /* remove tabs, spaces, newlines, etc. */
    	$minify = str_replace( array("rn", "r", "n", "t", '  ', '    ', '    '), '', $minify );

        return $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.


Web Font Optimization – Compress, opentype .otf, eot .eot, truetype .ttf, & woff fonttype

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


<IfModule mod_deflate.c>
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/javascript
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/x-javascript
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/javascript
AddOutputFilterByType DEFLATE text/plain
<IfModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
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_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*

# Leverage Browser Caching
<IfModule mod_expires.c>
ExpiresActive On
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 text/x-javascript “access 1 month”
ExpiresByType application/x-shockwave-flash “access 1 month”
ExpiresByType image/x-icon “access 1 year”
ExpiresDefault “access 1 month”
<IfModule mod_headers.c>
<filesmatch “\.(ico|flv|jpg|jpeg|png|gif|css|swf)$”>
Header set Cache-Control “max-age=2678400, public”
<filesmatch “\.(html|htm)$”>
Header set Cache-Control “max-age=7200, private, must-revalidate”
<filesmatch “\.(pdf)$”>
Header set Cache-Control “max-age=86400, public”
<filesmatch “\.(js)$”>
Header set Cache-Control “max-age=2678400, private”



woff font type gzip

ttf font zip