Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Remove query strings from static resources

Started by Muut Archive 11 years ago · 2 replies · 548 views
11 years ago

I have my website zipping along really nicely and it's fast...super fast. But I would love to get it to lightning fast.

Enabled Cloudflare and I've enabled advanced-pagecache, precache, staticfilecache and twigcache and also ramped up the browser caching by adding the following to my .htaccess

TXT

## EXPIRES 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>
## EXPIRES CACHING ##
--- 

The only thing holding it back seems to be this element in [Pingdom](http://tools.pingdom.com/) and [Google Page Insights](https://developers.google.com/speed/pagespeed/insights/).

*Remove query strings from static resources* - Pingdom and 
*Eliminate render-blocking JavaScript and CSS in above-the-fold content* - Google

Is there an option to do this in Grav or will I need to do something with htaccess or another type of plugin?
11 years ago

BTW, advanced page-cache kinda kills the need for precache, staticfilecache, and even twigcache. It's just caching the whole page output.

There are two options in the system config:

YAML
assets:
  enable_asset_timestamp: false

media:
  enable_media_timestamp: false

These are off by default, but if you have enabled either of these, they will cause the ?3893930920 type stuff at the end of the items.

Note: turning this off will mean your CDN and even the browser doesn't know if an asset has changed, and while it makes it faster, it makes it very hard to get any content changes to your end users

11 years ago

Awesome - will give this a go and see what happens. Cheers!

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1330 9 years ago
Archive · by Muut Archive, 9 years ago
2 922 9 years ago
Archive · by Muut Archive, 9 years ago
2 4052 9 years ago
Archive · by Muut Archive, 9 years ago
1 2930 9 years ago
Archive · by Muut Archive, 9 years ago
3 1109 9 years ago