> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gcore.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Integrate a CDN resource with WordPress using W3 Total Cache

> Set up W3 Total Cache Generic Mirror to serve WordPress static files from a Gcore CDN custom domain.

W3 Total Cache is a WordPress plugin that rewrites static file URLs so browsers request those files from a Gcore CDN custom domain instead of the origin. A [CDN resource](/cdn/getting-started/create-a-cdn-resource/create-a-cdn-resource) must exist first, and the [custom domain](/cdn/cdn-resource-options/general/create-and-set-a-custom-domain-for-the-content-delivery-via-cdn) must have a CNAME record pointing to the `*.gcdn.co` target shown in the CDN resource's **Setup guide**.

> [!WARNING]
>
> Back up the WordPress files and database before installing the plugin. These steps assume a default WordPress file layout. A heavily customized layout might not rewrite URLs correctly.

## W3 Total Cache plugin setup

W3 Total Cache adds a **Performance** menu to the WordPress admin sidebar after it is activated.

**1. Open the plugin installer**

Log in to WordPress admin (`example.com/wp-admin`) and navigate to **Plugins** > **Add Plugin**.

**2. Install and activate the plugin**

In **Search Plugins**, enter `W3 Total Cache`. On the W3 Total Cache card by BoldGrid, click **Install Now**, then **Activate**.

If the **Setup Guide** wizard opens, click **SKIP** to reach the settings pages.

## W3 Total Cache CDN settings

Generic Mirror is the W3 Total Cache type that rewrites hostnames in HTML without pushing files to a storage API. That is the type to use with Gcore CDN.

**1. Enable Generic Mirror**

Navigate to **Performance** > **General Settings** and scroll to the **CDN** section.

1. Select **Enable**.

2. In **CDN Type**, select **Generic Mirror**.

3. Click **Save Settings**.

![CDN section with Enable selected and Generic Mirror as the CDN type](https://mintcdn.com/gcore/LZoR7Pome7yXrZOE/images/docs/cdn/getting-started/integrate-cdn-with-cms/wordpress/integrate-cdn-resource-with-wordpress-w3-total-cache-plugin/07.PNG?fit=max\&auto=format\&n=LZoR7Pome7yXrZOE\&q=85\&s=38f546cb2d1bb67cac38ab63b7da9308)

A notice appears because the hostname field is still empty: *A configuration issue prevents CDN from working: The "Replace default hostname with" field cannot be empty.* Click **Specify it here**, or navigate to **Performance** > **CDN**.

![Notice that the hostname field is empty, with a Specify it here link](https://mintcdn.com/gcore/LZoR7Pome7yXrZOE/images/docs/cdn/getting-started/integrate-cdn-with-cms/wordpress/integrate-cdn-resource-with-wordpress-w3-total-cache-plugin/10.PNG?fit=max\&auto=format\&n=LZoR7Pome7yXrZOE\&q=85\&s=6057842ad061fb473024cabeb428f3b6)

**2. Enter the custom domain**

In **Replace site's hostname with**, enter the custom domain from the [Gcore Customer Portal](https://portal.gcore.com) (**CDN** > **CDN resources**). Use the custom domain (`cdn.example.com`), not the `gcdn.co` hostname. Click **Save Settings & Purge Caches** to save and clear cached HTML so pages are regenerated with the CDN hostname. If only **Save Settings** is available, navigate to **Performance** > **Purge All Caches** separately.

![Replace site's hostname with field and Save Settings on the CDN page](https://mintcdn.com/gcore/LZoR7Pome7yXrZOE/images/docs/cdn/getting-started/integrate-cdn-with-cms/wordpress/integrate-cdn-resource-with-wordpress-w3-total-cache-plugin/09.PNG?fit=max\&auto=format\&n=LZoR7Pome7yXrZOE\&q=85\&s=bce9d462b915fe49f4282f4b36cd7e2b)

**3. Confirm CDN delivery**

Open the site in a logged-out private browser window. In browser developer tools, open **Network**, disable the browser cache, and reload the page. Static files should request the custom domain instead of the origin hostname. Select a cached asset and confirm that a repeated request returns `HIT` in the `Cache` response header.
