How to cache Joomla site?

Need help with the Administration of your Joomla! 5.x site? This is the spot for you.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10
Post Reply
pl71
Joomla! Intern
Joomla! Intern
Posts: 58
Joined: Tue Mar 18, 2014 11:24 am

How to cache Joomla site?

Post by pl71 » Sat Mar 30, 2024 9:30 pm

It has been discussed probably a thousand times.
What is the best approach for caching a small site like a blog updated weekly?

Presently I have in Global Configuration:
System Cache: ON - Conservative caching
Cache handler: File
Platform-specific caching: No
Cache time: 30 min
Path to cache folder: [BLANK]


Additionally, I have the following code in .htaccess file:

Code: Select all

<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 week"
# Images
ExpiresByType image/x-icon "access plus 1 year"
ExpiresByType image/svg+xml "access plus 1 year"
ExpiresByType image/webp "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
...
...
</IfModule>
This code is circulating in many sites, and I believe it is correct without errors.

Surprisingly https://pagespeed.web.dev is complaining:
Serve static assets with an efficient cache policy --- 13 resources found
The problem was mostly in CSS files. PageSpeeds wants CSS to be cached for more than 2 months, though JS could be only month cached. Strange.
Presently mine:

Code: Select all

ExpiresByType text/css "access plus 6 month"
For me, caching is doubled, but I'm not sure if this is good or bad.
What do you think about all that? Is it OK .htaccess to include ExpiresByType directives when Caching is ON in Global Configuration? Or are they different things?

User avatar
pe7er
Joomla! Master
Joomla! Master
Posts: 25009
Joined: Thu Aug 18, 2005 8:55 pm
Location: Nijmegen, Netherlands
Contact:

Re: How to cache Joomla site?

Post by pe7er » Sun Mar 31, 2024 10:07 am

I'd recommend to set "Platform-specific caching" to "Yes".

Otherwise you run into problems with visitors from different devices:
a mobile visitor will let Joomla cache a page for a mobile device. When the next visitor with desktop device visits the same page, the cached for mobile page will be displayed, hence that visitor will see a very small site.
Kind Regards,
Peter Martin, Global Moderator
Company website: https://db8.nl/en/ - Joomla specialist, Nijmegen, Netherlands
The best website: https://the-best-website.com

pl71
Joomla! Intern
Joomla! Intern
Posts: 58
Joined: Tue Mar 18, 2014 11:24 am

Re: How to cache Joomla site?

Post by pl71 » Sun Mar 31, 2024 5:00 pm

Thanks, Peter.
What about .htacces in this case? Is it OK to remain like that?


Post Reply

Return to “Administration Joomla! 5.x”