• 18 October 2024

When you are activating the ArvanCloud CDN service for your website, the entire content of your WordPress website will be, by default, stored on the ArvanCloud edge servers for 30 minutes. However, it is sometimes needed not to cache some parts of the website, or, in another case, the cache timeframe should be more than 30 minutes due to staying constant in a more extended time.

You should open the ArvanCloud panel, then the Content Delivery Network (CDN) section, and then Page Rules to determine the content which you should cache and the content which you should not.

Here, you will get instructions on how to set these rules for a WordPress website.

How to Define the Page Rule on the ArvanCloud User’s Panel

In the following lines, you will get familiar with the most significant parts which you should not cache their data, or which you should save their data on the ArvanCloud edge servers for a longer duration. Notice that the addresses provided for different files make the default paths. Thus, if you have changed these default paths, assign your defined address to the rules.

Tip: The rules which you define in this section will have priority. Hence, when you consider it as a high priority, you should insert a higher number in the Priority section as you are defining it. This way, you place it on the top of the list to be checked first.

Tip: When you are defining a rule, it will exactly correspond with that one typed in the address bar. Therefore, when you mark a URL by www, the system will match it only with the requests possessing a www URL. You can insert this symbol “*.” instead of www so that the rule matches both URLs, whether marked by www or not.

Look at the following example:

    • *.yoursitename.com

  • Wp-admin File: The system employs this file to store the data correlated with the Admin Panel. Therefore, you should not save its data on the ArvanCloud edge servers. If you do not want to cache the data, open the Page Rule section, click on the New Rule, and define the following rule. Then, according to what you see in the image, select the Turn off option from the Cache Operation Level:
    • www.yoursitename/wp-admin/*

  • Login File: The system employs this file to verify the users’ information as they are entering the WordPress. Therefore, we should categorize the file data among the group that the system should not store their data on the ArvanCloud edge servers. Define the following rule to gain this end:
    • www.yoursitename/wp-login/*

  • Staging File: If you have created a clone version to test and develop your website, you do not need to save this file content on the ArvanCloud edge servers. Thus, define the following rule to prevent the storage of the file content:
    • www.yoursitename/staging/*

  • WooCommerce Cookies: If you owe a store website and you are using WooCommerce plugin, you can employ the following rules to prevent the storage of the WooCommerce cookies on the ArvanCloud edge servers:
    • www.yoursitename/woocommerce_cart_hash/*
    • www.yoursitename/woocommerce_items_in_cart/*
    • www.yoursitename/wp_woocommerce_session_/*

Uploads File: The files uploaded on the website (notice that the system also stores them in a file named uploads) do not change considerably and remain stable in the long-term. Thus, you can define a rule to save the file content on the ArvanCloud edge servers for a more extended time. For this purpose, you should employ the following one and select, for example, 30 days from the Verified Timeframe for the Cached Data section. Be careful that the file content is stable, so the longer the duration, the better it would be. The reason is that the ArvanCloud edge servers reference to the central server that hosts your WordPress website will decrease:

www.yoursitename/wp-content/uploads/*

  • Content File: This file usually consists of the languages, plugins, and layers files. As you know, these sorts of content rarely change in the short-term. Hence, you can define a rule to store these files content on the ArvanCloud edge servers for a longer duration. You can apply the following rule to obtain your goal:

www.yoursitename/wp-content/*

Tip: Notice that you should manage the cache management plugins such as wp-rocket yourself, and the ArvanCloud CDN service only displays the content which you have cached through the plugins.

How to Set the Browser Cache for a Website

The GTMetrix website is a tool to test the websites’ agility. You will not receive a high credit in the Leverage Browser Caching section of the GTMetrix unless you set the browser cache on 30 for your website. We should mention to the point that the number 7 is the fewest allowed value for the browser cache.

To put the settings, open the Content Delivery Network (CDN) and the Caching Settings; then, assign your value to the Verified Timeframe for the Cached Data section.

Notice that the system will apply the settings to the entire content cached on the ArvanCloud edge servers except for the cases that you have, in the Rule section, determined not to be cached.

Tip: You’d better refer to the results that GTMetrix has obtained from your website analysis to know which files you can cache on the ArvanCloud edge servers for a more extended time. You can also employ the GTMetrix results to learn how to and for what files you should define the rules.