SiteGround Cache
SiteGround Cache gets SiteGround's server cache working on your Joomla site. SiteGround puts a cache in front of every site it hosts. It serves stored copies of your pages without running Joomla at all, which is much faster for your visitors and much lighter on your hosting account.
Out of the box that cache almost never stores a Joomla page, for two reasons:
- Joomla gives every visitor a session cookie. SiteGround won't store a page that sets a cookie, because the next visitor would be handed someone else's cookie.
- Joomla marks every page "do not cache". SiteGround respects that.
That's why the SiteGround dashboard warns that fewer than 60% of your visits are served from cache. The plugin removes both obstacles on the pages every visitor sees the same way, tells SiteGround those pages can be stored, and clears the stored copies when you change your content.
New to SiteGround Cache? This page is the reference manual. For an overview of what SiteGround Cache does, with screenshots and the download, see its page on cybersalt.com.
Release history. This page documents the current release. For what changed in each version, see the changelog.
Requirements. Joomla 5.0 or newer (it runs natively on Joomla 5 and Joomla 6), PHP 8.1 or newer, and SiteGround hosting. The plugin talks to a service that only exists on SiteGround's servers. It installs anywhere, but on other hosts it shows a notice and does nothing.
SiteGround Cache is free and open source, available from cybersalt.com.
⤢ Click to enlarge
Installing
- Download the zip (
plg_system_sgcache_v*.zip) from cybersalt.com. - In your Joomla admin go to System → Install → Extensions and upload the zip.
- Go to System → Manage → Plugins, search for
SiteGround Cacheand make sure System - Cybersalt SiteGround Cache is enabled (its status icon is green).
The plugin registers Cybersalt's update server, so new versions show up under System → Update → Extensions like any other extension. Updating keeps your settings.
Checking it works
- Open the plugin. The status panel at the top of the Plugin tab should show SiteGround Hosting: Detected, Cache Daemon: Reachable and Set-Cookie Suppression: Stripping. Click Run Test to check again.
- Click Test my home page. The plugin fetches your home page and your newest article the way a visitor would, twice each, and tells you whether SiteGround served the second request from its cache. If it didn't, it says why, for example which form on the page needs the visitor's session.
- To check by hand, open your site in a private (incognito) browser window, open the developer tools
(F12) and go to the Network tab. Reload the page and click the
first request in the list. Its response headers should include
X-Cache-Enabled: Trueand noSet-Cookie. - Reload once more.
X-Proxy-Cache: HITmeans SiteGround served the page from its cache.MISSon the first load is normal: that's the visit that filled the cache. - The ratio on your SiteGround dashboard climbs over the next day or two as the cache fills.
Use the browser, not curl. Checking from a command line often gets
a 403 error, because SiteGround's firewall blocks requests that don't look like a browser.
What gets cached and what doesn't
| Page | Cached? |
|---|---|
| Ordinary pages, for visitors who aren't logged in | Yes |
| Any page for a logged-in user | No, unless you turn on Cache for Logged-in Users (Advanced tab) |
| Pages whose forms are all Convert Forms, RSForm! Pro or the Joomla login module (or a form you list by marker) | Yes, with the form's security token taken out. Each visitor's browser fetches its own token the first time they use the form. See Pages with forms. |
| Pages with any other Joomla form, such as a voting or comment form | No. The plugin spots the form's security token and leaves the page alone, so the form still submits. |
| Feeds, JSON and other non-page output, and error pages | No, never |
Addresses with a query string (?something=...) |
No, except marketing tracking parameters such as utm_source or
fbclid, and parameters you list in Cacheable Query Parameters |
| A page shown to a visitor who already has a session (a cart, a form refilled after an error), a page showing a message for the visitor, or a page showing their IP address | That copy isn't stored. Pages are stored from visits without a session, and every visitor, returning ones included, is served the stored copy. |
| Pages from an excluded component. By default these are Users, Smart Search, Contacts and Privacy | No |
| Addresses listed in Excluded URLs, pages under Excluded Menu Items, and pages rendered for Excluded User Agents | No |
| Anything other than a normal page view, such as a form being submitted | No |
The Plugin tab also shows a File check: whether every installed file matches the released version. After a failed update it names the files that are missing, empty or changed; installing the same package again repairs them. The Recent Uncached Visits tile counts how many of the last 50 pages built for visitors could be cached, and warns when most were skipped for one fixable reason, such as a form the plugin doesn't recognise on every page.
The plugin only tells SiteGround a page can be cached once it has checked that no cookie is left on it. If something else adds a cookie after the plugin has run, the page goes out marked as not cacheable, and the plugin logs a warning so you can find out which extension did it.
Pages with forms
Every Joomla form carries a security token that belongs to the visitor's session, and the form is refused if the token doesn't match. A cached copy is shared by everyone, so it can't carry one visitor's token. On many sites every page has a form (a newsletter sign-up in the footer, a login box in the sidebar), and those pages could never be cached.
With Cache Pages with Forms on (the default), the plugin caches such a page with the token taken out. The first time a visitor clicks into, taps or types in the form, their browser quietly asks your site for their own token, which also starts their session, and puts it in the form. A click on the submit button that comes before the token has arrived is held for a moment and then goes through. The form submits normally.
This is done only for forms the plugin knows need nothing else from the session:
Convert Forms, RSForm! Pro and Joomla's login
module, each of which you can untick. For another form, add a piece of text that appears
in its HTML (for example id="newsletter") to Other Forms (markers), but only
after checking it keeps nothing else in the visitor's session, such as a captcha answer or a cart.
Any form the plugin doesn't recognise keeps its page uncached, exactly as before.
Check each form once. After updating, send each of your forms once from a private browser window. The visitor's browser needs JavaScript for this; Convert Forms needs it anyway.
When the cache is cleared
With Auto-Purge on Content Change on (the default), the plugin clears stored pages for you:
| You do this | The plugin clears |
|---|---|
| Save, delete, publish or unpublish an article or a category | Everything, once |
| Save anything else Joomla treats as content, such as a module, a menu item or an item in another extension | Everything, once |
| Save a template or a template style | Everything |
| Install, update or remove an extension | Everything |
| Switch a plugin on or off in the Plugins list, or save this plugin's settings | Everything |
A content save clears everything on purpose: modules such as Latest News show articles on every page, so clearing only the article's own address would leave them out of date. Saves that never change what visitors see, such as the log entries Joomla's Scheduled Tasks write, don't clear anything.
To clear it yourself, use the Purge SiteGround Cache button at the top of every admin page, or Purge All Cache on the plugin's Advanced tab. It clears SiteGround's cache only: Joomla's own System → Clear Cache, and the clean-cache buttons of optimisers such as JCH Optimize, don't touch SiteGround's cache, and this button doesn't touch theirs.
⤢ Click to enlarge
Settings
Plugin tab
| Setting | Default | What it does |
|---|---|---|
| Enable Dynamic Cache | Yes | Marks cacheable pages for SiteGround's cache. Turn it off and nothing is cached. |
| Auto-Purge on Content Change | Yes | Clears the affected pages when content changes (see the table above). |
| Purge Threshold | 10 | Only matters for saves that queue individual addresses without the home page: past this many, the plugin clears everything at once instead. From 1 to 100. |
| Excluded URLs | (empty) | Addresses that should never be cached, one per line, relative to your site. A plain
address also covers everything that starts with it: /members covers
/members/profile. * stands for any text
(/shop/*/checkout), a trailing $ means that address only
(/about$), and a ? matches the query string too
(/search?q=). Use it for pages that show different content to each visitor. |
| Excluded Components | Users, Smart Search, Contacts, Privacy | Components whose pages are never cached. Pick from the list of installed components. |
| Excluded Menu Items | (none) | Menu items whose pages are never cached. Joomla also counts pages reached through a menu item, such as the articles of a category blog. |
| Cacheable Query Parameters | (empty) | Query parameters that may be cached, one per line, for example start or
limitstart for paginated lists. format, tmpl and
task never are, and neither is an address that mixes a listed parameter with a
tracking one. |
| Excluded User Agents | (empty) | Text such as Feedly or UptimeRobot, one per line. A page rendered
for a browser or bot whose user agent contains it isn't stored. SiteGround can still answer
it from a copy stored for someone else, unless Vary by User Agent is on. |
| Cache Pages with Forms | Yes | See Pages with forms. |
| Forms That May Be Cached | All three | Convert Forms, RSForm! Pro and the Joomla login module. |
| Other Forms (markers) | (empty) | Text that identifies another form you've checked, one per line. |
Toolbar tab
⤢ Click to enlarge
| Setting | Default | What it does |
|---|---|---|
| Show Purge Button in Admin | Yes | Shows the Purge SiteGround Cache button in the admin header. |
| Button Mode | Simple - Purge All | Simple: one button that clears everything. Dropdown: the same button plus a list of your own shortcuts. |
| Purge Specific Path | (empty) | Dropdown mode only. One shortcut per line, written as Label|/path, for example
Blog|/blog or News|/news. |
Logs tab
⤢ Click to enlarge
| Setting | Default | What it does |
|---|---|---|
| Enable File Logging | No | Writes cache activity to a log file in Joomla's log folder (Global Configuration → System → Path to Log Folder). Useful when something isn't working; leave it off otherwise. |
| Verbose Logging | No | Logs every page view and why it was or wasn't cached. Turn it on only while troubleshooting: it records the address of every page visited, which can include search terms or member-only paths. |
| Log File / Max Log Size | sgcache.log / 5 MB | The file name, and the size at which the log is rotated. The last five rotated files are
kept. The file is stored with .php added (sgcache.log.php) and
starts with a line that stops a browser from reading it, like Joomla's own logs. |
| Enable Debug Panel | No | Shows a panel at the bottom of admin pages listing the cache operations from that page load. Only administrators see it. |
Advanced tab
⤢ Click to enlarge
| Setting | Default | What it does |
|---|---|---|
| Vary by User Agent | No | Stores separate copies for different browsers, for sites that send mobile visitors a different page from desktop visitors. |
| Cache for Logged-in Users | No | Lets SiteGround cache pages for logged-in users too. Only turn this on if every user sees exactly the same content; otherwise one member could be shown another member's page. |
| Suppress Session Cookie on Cacheable Pages | Yes | Removes Joomla's session cookie from pages that can be cached. Leave it on: with it off, SiteGround can't store anything. |
| Purge All Cache | Clears everything SiteGround has stored for this site. |
Home page watchdog
An optional scheduled task checks that your home page is still a normal page. The installer adds it to System → Scheduled Tasks as SiteGround Cache: home page watchdog, unpublished. Publish it to have the home page fetched every 15 minutes, as a visitor would. If it, or any extra address you list in the task, comes back as something other than a web page, the task clears SiteGround's cache, checks again and emails a report (to the address in the task, or the site's From address).
The task stores your site's address, filled in for you, because a task run from the command
line (cli/joomla.php scheduler:run) can't work out the address by itself.
Troubleshooting
| Symptom | Cause and fix |
|---|---|
| The SiteGround dashboard still says fewer than 60% of visits come from cache | Give it 24 to 48 hours, then do the header check under
Checking it works. If pages show
X-Cache-Enabled: False, turn on file logging and verbose logging, visit one of
those pages, and look at the log: it records why the page wasn't cached. |
| The status panel says SiteGround Hosting: Not detected | The site isn't on SiteGround, or it has moved away. The plugin can't do anything there, so it can be disabled or uninstalled. |
| A form says it has expired or its token is invalid | Update to the latest version. If the form is one of the cached kinds, check that the visitor's browser has JavaScript on. If the form is loaded in a way the plugin can't see, add its page to Excluded URLs, or untick its type under Forms That May Be Cached. |
| Test my home page or the Recent Uncached Visits tile says a form keeps pages uncached | The message names the form. If it's one you've checked needs nothing but the token, add a piece of text from its HTML to Other Forms (markers). |
| Your home page shows a feed, raw code or a blank page | Click Purge SiteGround Cache, then update to the latest version, which never stores anything but a normal page. Publish the home page watchdog to catch it automatically. |
| A change doesn't show up for visitors | Content saves clear the whole cache, so check Auto-Purge on Content Change is on. For changes made outside Joomla's editing screens (files, the database, another optimiser), click Purge SiteGround Cache. |
| A visitor sees content meant for someone else | Add that page to Excluded URLs or its menu item to Excluded Menu Items straight away, and let us know which page and which extension shows the content, so we can handle it automatically. |
The log shows set_cookie_not_stripped or cache_claimed_with_cookie |
Another extension is adding a cookie to the page. The page is left uncached, which is safe. Verbose logging shows which pages it affects. |
Questions people ask
Does it replace Joomla's own cache? No. Joomla's System - Page Cache plugin stores pages inside Joomla; SiteGround's cache sits in front of the server and is faster still. You don't need Joomla's page cache as well.
Is caching pages with forms safe? Yes. No visitor's token or session ever goes into a cached copy: the token is taken out before the page is stored, and each visitor's browser fetches its own. Other sites can't read that token. Pages built for visitors who already have a session aren't stored at all.
Will logged-in members see stale pages? No. Logged-in users always get fresh pages unless you turn on Cache for Logged-in Users.
What happens if I move the site away from SiteGround? The plugin notices, shows a notice in the admin and stops doing anything. You can then uninstall it.
Is it made by SiteGround? No. It's an independent Joomla plugin by Cybersalt. It talks to SiteGround's cache the same way SiteGround's own WordPress plugin does.
Getting help
Questions and bug reports are welcome through the Cybersalt support form or GitHub.
You'll get the quickest answer if you include your Joomla and PHP versions, the plugin version (shown on the plugin's About tab), the address of a page that shows the problem, and, if you can, the response headers from that page.
SiteGround Cache is developed by Cybersalt Consulting Ltd. and released under the GNU General Public License v2 or later. SiteGround is a trademark of SiteGround; this plugin is not affiliated with or endorsed by SiteGround.
The Purge SG Cache button — click anywhere to closeClose ×
Toolbar tab — click anywhere to closeClose ×
Logs tab — click anywhere to closeClose ×
Advanced tab — click anywhere to closeClose ×