You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We've just launch our first Grav website, upon checking the website through webpagetest.org to test loading performance it gives us a big RED F for caching. Coming from Drupal CMS background there's a htaccess rules that Drupal is using to work around with this. I copy pasted the htaccess rules and it fixes the problem. I am suggesting it to be added and be shipped with Grav htaccess files, following are the rules i've added
# Requires mod_expires to be enabled.
<IfModule mod_expires.c>
# Enable expirations.
ExpiresActive On
# Cache all files for 2 weeks after access (A).
ExpiresDefault A1209600
<FilesMatch \.php$>
# Do not allow PHP scripts to be cached unless they explicitly send cache
# headers themselves. Otherwise all scripts would have to overwrite the
# headers set by mod_expires if they want another caching behavior. This may
# fail if an error occurs early in the bootstrap process, and it may cause
# problems if a non-Drupal PHP file is installed in a subdirectory.
ExpiresActive Off
</FilesMatch>
</IfModule>
Regards,
Danreb
The text was updated successfully, but these errors were encountered:
Tested and works, while I'm not sure it's a good default for every site, as cache is something you enable only when deploying a site, not when developing for example, while our .htaccess contains just what's needed to run. And not everyone would need that maybe. Just tested that getgrav.org gets all A/B on that webpagetest.org test, but uses a CDN for assets so that line you propose is not needed to get an optimal performance for assets caching.
@rhukster can we add this commented in the htaccess, ready to be used, or should we add a "improving performance" section in the Learn docs with this and other suggestions?
Hi There,
We've just launch our first Grav website, upon checking the website through webpagetest.org to test loading performance it gives us a big RED F for caching. Coming from Drupal CMS background there's a htaccess rules that Drupal is using to work around with this. I copy pasted the htaccess rules and it fixes the problem. I am suggesting it to be added and be shipped with Grav htaccess files, following are the rules i've added
Regards,
Danreb
The text was updated successfully, but these errors were encountered: