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:

  • www.yoursitename/woocommerce_cart_hash/*
  • www.yoursitename/woocommerce_items_in_cart/*
  • www.yoursitename/wp_woocommerce_session/*

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.



    • Related Articles

    • Setting Up Redirect Page Rules on VergeCloud: Guide to Managing Website Redirects

      Redirect Configuration In this section, you can learn how to direct traffic from a specific URL to another within the Page Rules area. To begin, navigate to the Page Rules section of your user panel under the VergeCloud CDN service and select the ...
    • Migrating Your API Domain to a CDN with 1-Second Caching Strategies

      Understanding the Challenge APIs serve as the backbone of modern applications, enabling seamless communication between services. However, slow API response times and high latency can significantly degrade user experience and increase infrastructure ...
    • Modify HTTP Headers on the Fly with VergeCloud CDN

      Understanding the Challenge Web applications and APIs rely on HTTP headers for authentication, caching, security, and traffic management. However, modifying headers at the origin often requires server-side code changes, leading to: Complex deployment ...
    • Advanced HTTP Header-Based Firewall with VergeCloud

      Understanding the Challenge Traditional firewalls focus on IP-based filtering, which can be bypassed by proxy networks, VPNs, and botnets. As attackers evolve, businesses require finer-grained security controls to detect and block threats at the HTTP ...
    • How to Record Visitors' True IP Addresses with VergeCloud

      Recording True IP Addresses Behind VergeCloud Proxy VergeCloud employs a reverse proxy approach, meaning the visitor IP addresses displayed in logs often show VergeCloud's IP instead of the actual visitor IPs. To address this, VergeCloud stores the ...