Subdomains and subdirectories
After you enable APO, you configure it to run on the subdomain that uses WordPress. For example, if you have a website called www.mysite.com
which includes a subdomain running WordPress called shop.mysite.com
, you would configure APO to run on the shop.mysite.com
subdomain.
- Install version 4.4.0 or later of the Cloudflare WordPress plugin.
- Log in using Cloudflare API token or Global key.
- Enable APO. The subdomain displays in the list of hostnames in the card.
- Repeat the process for each subdomain to enable APO.
By default, APO runs on the apex domain (also known as "root domain" or "naked domain"). If you choose to run APO on a subdomain, the apex domain is automatically disabled. To run APO on a subdomain and the apex domain, upgrade the WordPress plugin to version 4.4.0 or later on the apex domain and re-enable APO.
After you enable APO, you configure it to run on the subdirectory that uses WordPress. For example, if you have a website called www.mysite.com
which includes a subdirectory running WordPress called mysite.com/shop
, you would configure APO to run on the mysite.com
domain.
- Install the Cloudflare WordPress plugin.
- Add your Cloudflare API Token.
- Activate APO.
Repeat steps 1 and 2 for each subdirectory to activate the WordPress plugin for automatic cache purging.
If you choose to run APO only on a subdirectory, the rest of the domain should be configured to bypass APO. You can bypass APO in one of two ways.
The cf-edge-cache: no-cache
instructs the APO service to bypass caching for non-WordPress parts of the site. You can implement this option with Cloudflare Workers using the example below.
Create a cache rule to exclude non-WordPress portions of the site from caching using Cache eligibility: Bypass cache. This option disables all caching, including static assets for those paths. As a result, we recommend disabling APO via the response header.