Page caching
When a visitor comes to your WordPress site, their browser talks to your web server which loads up WordPress – this involves PHP processing, making requests to your database, sending files back to the browser to finally be assembled into a fully formed webpage. This can take several seconds – an eternity to modern web surfers.
The page caching feature which is activated automatically by default makes your site faster by removing the PHP and requests to the database and saving the content to HTML files. For each page, you'll find at least two files, depending on your settings.
Those files will be:
Basic cache files
index.html
- HTML page for websites with no SSL certificate, using HTTPindex-https.html
- HTML page for websites with an SSL certificate, using HTTPSindex-https.html_gzip
- The compressed HTML page in the gzip format.-
index-mobile-https.html
- HTML page for mobile created by the Mobile Cache feature.
Or depending on your WP Rocket settings, you may also see:
index-webp-https.html
- HTML page for the WebP version when WebP Compatibility is enabled.index-https-cookieValue.html
- If the mandatory/dynamic cookies method has been used or you're using a plugin with automatic cookies compatibility, it's expected to see files named like this.
i.e: example from the Cookie Notice plugin
Each cached page on your site will have a dedicated folder with the cache files inside. You can find it going through the /cache/wp-rocket/your-domain.com/ folder, as shown below:
Once created, these files will be served to your visitors either by:
- Rewrite rules in the .htaccess or NGINX configuration for WP Rocket.
- PHP files which happens in when the rewrite rules are removed from the .htaccess. The same goes for NGINX servers where the NGINX WP Rocket configuration hasn't been applied.
The full URL of the cached file (i.e: https://yourdomain.com/wp-content/cache/wp-content/your-domain/your-page-name/index-https.html.gzip) shouldn't appear directly to the visitor. If it does, check this guide for solutions: Resolve redirection to index_gzip.html issue
How to check if page caching is working
In normal conditions, the cache folder will contain:
- The cache files of the homepage.
- A subfolder for each subpage, with the respective cache files inside.
If the cache folder is empty, please try the following to discard a problem:
- Trigger the Preload with the "Clear and preload cache" option in the top bar menu.
- Manually visit a few of your site's pages using an incognito window.
The files should be generated and placed into the cache folder.
Note: check the hosting compatibility article to see if your hosting provider uses its own page caching option. In those hosting companies, WP Rocket's cache folder will be empty.
However, if your hosting provider isn't using their own page caching, and you still don't see the cache files being generated, there may be a problem with page caching. In that case, you should check the following article:
Pages are not cached or optimizations are not working
What about the SEO?
Even it's possible to visit these pages via the browser, like https://yourdomain.com/wp-content/cache/wp-content/your-domain/your-page-name/index-https.html - these pages shouldn't be a problem since the canonical tag will contain the correct URL for SEO purposes
More information
If you're interested to know more about page caching, how it's preloaded, how often it's cleared, or how to disable the page caching, check the following articles out.