When you activate VergeCloud CDN for your WordPress site, content is cached on VergeCloud's edge servers for 30 minutes by default. However, some parts of your website may need different caching settings. For example, you might want to exclude certain pages from caching or set longer cache durations for static content.
To adjust caching settings, go to the VergeCloud panel, navigate to the CDN section, and then open the Page Rules section. Here’s how to configure the rules for specific parts of your WordPress site.
Page rules allow you to control caching on specific pages. Below are steps to adjust these rules for your WordPress site. If you have custom paths, use your own paths instead of the default ones provided.
Tip: Rules created in this section have a higher priority when applied. To ensure a rule is checked first, assign a higher priority number.
Tip: Ensure the URL matches exactly as typed in the address bar, including "www." Use “*.” to apply rules to both "www" and non-"www" versions of URLs.
Example:
*.yoursitename.com
Wp-admin File: The wp-admin file holds sensitive data and should not be cached. To exclude it from cache:
www.yoursitename/wp-admin/*
.Login File: Similar to wp-admin, the login page must not be cached. To exclude it from cache:
www.yoursitename/wp-login/*
.Staging File: If you have a staging version of your site, there’s no need to cache it. To exclude it from cache:
www.yoursitename/staging/*
.WooCommerce Cookies: For WooCommerce, exclude caching for cart-related cookies to prevent issues with dynamic data. Create rules for the following URLs:
For each of these, follow the same steps: create a new rule, enter the URL, select “Turn off” under Cache Operation Level, and save the rule.
Uploads File: Files in the “uploads” directory are generally static and can benefit from longer cache durations. To cache these files for an extended period (e.g., 30 days), follow these steps:
www.yoursitename/wp-content/uploads/*
.Content Files: Content files such as language files, plugins, and themes rarely change and can also be cached for longer durations. To apply this:
www.yoursitename/wp-content/*
.Tip: If you're using caching plugins like WP Rocket, ensure that VergeCloud CDN serves the content cached through these plugins. Configure them according to your needs.
Browser caching is important for improving the speed of your website by reducing the need to download the same resources multiple times. A good GTMetrix score in the "Leverage Browser Caching" section can be achieved by setting the browser cache duration to 30 days. The minimum duration is 7 days, but setting it to 30 days is ideal for most static files.
To set browser caching, go to the CDN and Caching Settings sections in the VergeCloud panel. Adjust the “Verified Timeframe for Cached Data” setting to 30 days. This applies to all cached content unless overridden by specific Page Rules.
Tip: Use GTMetrix to review which files can be cached for a longer period. This can help you decide which files should be cached longer and how to adjust the rules accordingly.