Page Rules and Caching Settings for WordPress with VergeCloud CDN

Page Rules and Caching Settings for WordPress with VergeCloud CDN

Setting Up Page Rules and Browser Caching for Your WordPress Site with VergeCloud CDN

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.

How to Set Up Page Rules in VergeCloud Panel

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:

  • Go to the Page Rules section in the VergeCloud panel.
  • Click “New Rule.”
  • In the “URL” field, enter www.yoursitename/wp-admin/*.
  • Under “Cache Operation Level,” select “Turn off” to disable caching.
  • Save the rule to apply it.

Login File: Similar to wp-admin, the login page must not be cached. To exclude it from cache:

  • Go to the Page Rules section.
  • Click “New Rule.”
  • In the “URL” field, input www.yoursitename/wp-login/*.
  • Under “Cache Operation Level,” select “Turn off.”
  • Save the rule.

Staging File: If you have a staging version of your site, there’s no need to cache it. To exclude it from cache:

  • Go to the Page Rules section.
  • Click “New Rule.”
  • In the “URL” field, enter www.yoursitename/staging/*.
  • Choose “Turn off” under Cache Operation Level.
  • Click “Save” to apply.

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:

  • Go to the Page Rules section.
  • Click “New Rule.”
  • In the “URL” field, enter www.yoursitename/wp-content/uploads/*.
  • Under “Cache Time,” set a longer duration (e.g., 30 days).
  • Save the rule to apply it.

Content Files: Content files such as language files, plugins, and themes rarely change and can also be cached for longer durations. To apply this:

  • Go to the Page Rules section.
  • Click “New Rule.”
  • In the “URL” field, enter www.yoursitename/wp-content/*.
  • Set a long cache duration (e.g., 30 days).
  • Save the rule to apply it.

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.

How to Set Browser Caching for Your Website

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.