suitable graphs and text plus a real image of a japanese student male on a laptop with subject: WordPress Affiliate Link Caching: Fix Redirects

Exclude Affiliate Redirects From WordPress Caching

I am an independent internet marketer. If you click a link on this page and make a purchase or join a program, I may receive a small financial commission or referral credit at no extra cost to you. I only recommend tools and resources I believe add value

For WordPress affiliate link caching we need to set each caching plugin, host, and CDN to bypass exact redirect paths or referral parameters. Exclude those URLs from caching while ordinary content stays cached. The goal is reliable affiliate tracking without sacrificing your site’s speed. First, identify the requests that need special treatment, then configure the exclusions.

advertising D9 hosting company with text about free SSL certificates wih each platform can help with WordPress Affiliate Link Caching

Key Takeaways On WordPress Affiliate Link Caching

Affiliate redirects, referral landing requests, and private affiliate pages need different exclusions. A cookie rule alone won’t protect a first-time visitor who hasn’t received that cookie yet.

My advice is simple: use narrow URL rules, add the required cookie exclusions, and test the complete journey. Disabling caching across your whole site is usually unnecessary.

Identify Your Affiliate Redirects First

WordPress affiliate link caching problems involve two different journeys. Separating them makes the fix much easier.

Find your outbound redirect paths

Open your link-management plugin, which you also use for link cloaking, and export its saved links. Pretty Links and ThirstyAffiliates give you a central place to find branded redirects and their destinations.

Look for a dedicated prefix such as /go/. Exclude that entire prefix only when everything underneath it is an affiliate redirect. Otherwise, exclude individual redirect paths.

For each affiliate link, record the source page, branded redirect, destination, affiliate ID, and any SubID parameters. Back up your settings before changing them.

Keep the commercial labeling separate. My guide to qualifying affiliate links covers rel="sponsored", but that attribute doesn’t repair redirects or tracking.

Find your incoming referral URLs

If you run an affiliate program, a referral URL may send visitors directly to a product or landing page with ?ref= or ?coupon= attached.

The request must reach your referral tracking logic before cached content is served. Add bypass rules for the ref parameter and other tracking names, regardless of their values or position in the query string.

Use the parameter names your affiliate plugin actually uses. Excluding every URL containing a question mark is broader than necessary.

Exclude Private Pages and Tracking Cookies

Caching conflicts can cause missing visits, unrecorded referrals, or credit going to the wrong affiliate. Other symptoms include “Are you cheating” or “Cheatin Uh” errors and affiliates being unable to sign in.

A wrongly cached Affiliate Portal is more serious. It can expose one affiliate’s earnings, referrals, or payout information to another visitor.

Use this exclusion map alongside your redirect rules.

Request or cookieRequired treatment
Affiliate dashboard (the Affiliate Portal), affiliate registration page, and login pageExclude their actual page paths.
Pages containing Solid Affiliate shortcodesExclude each page from the full-page cache.
solid_visit_idAdd to the cookie-based cache bypass list.
Solid Affiliate multisite cookiesAdd the applicable name, such as solid_visit_id-2.
affiliate_for_woocommerce, afwc_hit, afwc_campaignPass these cookies through and bypass cached pages when required.
Requests containing ref or coupon parametersBypass caching so referral handling can run.

On multisite, Solid Affiliate uses solid_visit_id-$blog_id, with the site’s numeric ID replacing $blog_id.

A cookie-based bypass for an affiliate cookie applies only when the visitor’s request carries that cookie. The initial referral request still needs its own URL or parameter bypass.

Cookie exclusions may bypass subsequent pages for referred visitors. That doesn’t mean public caching is disabled for everyone.

Configure WP Rocket and LiteSpeed Cache

Siteground - with text - connect any wordpress site in minutes in 3 easy steps- can help with WordPress Affiliate Link Caching

Add only the paths and cookies your site uses with its caching plugin. Another site’s affiliate portal slug won’t help if yours is different.

WP Rocket

Open Settings > WP Rocket > Advanced Rules. Newer dashboards group these controls under Cache > Cache Rules.

In Never cache URL(s), enter your portal, registration, login, shortcode pages, and redirect paths. For a dedicated /go/ directory, the plugin’s pattern /go/(.*) covers its redirects.

Add solid_visit_id, or the applicable multisite cookie, under Never cache Cookies. For Affiliate for WooCommerce, add its three cookie names instead.

Don’t add ref or coupon to Cache Query String(s). Save your changes and clear its cache.

LiteSpeed Cache

Open LiteSpeed Cache > Cache > Excludes.

Use Do Not Cache URIs for the relevant paths. The pattern ^/go/ matches requests beginning with that directory. The anchors in ^/affiliate-portal/$ restrict it to that exact path, if that’s your portal slug.

Enter cookie names separately under Do Not Cache Cookies. Add ref and coupon, without question marks or values, to Do Not Cache Query Strings.

Save, then use LiteSpeed Cache > Toolbox > Purge > Purge All. Purge any separate host or CDN cache too.

Configure W3 Total Cache and WP Fastest Cache

These plugins have their own exclusion screens. The same principle applies: match the redirect request, protect private pages, and let tracking cookies through.

W3 Total Cache

Go to Performance > Page Cache, then find the Advanced settings.

Add your redirect paths and affiliate pages under Never cache the following pages. Enter each exclusion separately using that field’s supported matching format.

Under Rejected cookies, add the cookie names for your affiliate plugin. Include the multisite-specific Solid Affiliate name where applicable.

Keep referral requests out of any query-string caching allowlist. Save all settings and purge all caches. A rejected-cookie rule won’t help the visitor’s first request when no tracking cookie exists yet.

WP Fastest Cache

Open the Exclude tab and add page rules for your affiliate pages and redirects.

Use an exact-match rule for a single page. For a dedicated redirect directory, use a Start With rule matching its prefix. Add cookie rules separately for the required tracking cookies.

Save the exclusions, then clear all caches.

Query-based referral requests also need bypass protection. Apply the host or CDN rules below wherever that layer caches HTML, even after your WordPress plugin exclusions are saved.

Apply the Same Rules at Your Host and CDN

A WordPress exclusion can’t stop an upstream cache from answering first. That includes cached redirects as well as cached HTML pages.

Host caching, Varnish, NGINX, and Redis

Varnish and the NGINX FastCGI cache are server-level cache layers that can return a response before WordPress PHP runs. Redis can also store full-page responses in some setups, although ordinary Redis object caching is different.

For Kinsta, WP Engine EverCache, or SiteGround Dynamic Cache, request server-cache exclusions using your exact paths, parameter names, and cookie names.

For NGINX, the conditions should prevent both reading an existing FastCGI cache entry and storing a new response.

Temporarily disable the host’s page cache and retest. Repeat for CDN caching or Redis-backed full-page caching. If tracking works again, that layer needs the exclusions.

Cloudflare Cache Rules

home business academy - what is it

Open Caching > Cache Rules, create a custom rule, and choose Bypass cache under Cache eligibility.

Join these matching conditions with OR:

  • Match the dedicated redirect prefix with URI Path starts with, plus exact affiliate portal, registration, and login paths.
  • Match query strings starting with ref= or coupon=, or containing &ref= or &coupon=.
  • Match the Cookie field containing the required cookie name followed by =. Include each multisite-specific name you use.

Don’t merely remove referral parameters from the cache key. That can collapse different affiliate requests into the same cached response.

If Super Page Cache controls your Cloudflare integration, its documented cache controls include cookie, query-parameter, and URI exclusions.

Save the rules and purge existing cached redirects and pages.

Test the Redirect and Tracking Journey

Now comes the part that matters: proving the fix works for visitors. A successful click alone doesn’t prove that affiliate tracking recorded attribution or that referral tracking received the visit.

Use a fresh browser profile, not your logged-in administrator session. Logged-in users often bypass caching automatically, which can make test results misleading.

  1. Open Developer Tools before clicking. Select Network and enable Preserve log. Click the published affiliate link and inspect every redirect. Confirm that each Location header leads toward the intended offer, without loops or unrelated destinations.
  2. Inspect the tracking information. Follow the affiliate ID, click ID, and SubID through the handoff. A tracking endpoint may legitimately record a parameter before removing it. The important point is that the responsible system receives it.
  3. Inspect cookies and cache headers. In Application > Cookies, look for the expected tracking cookie after the relevant consent choice. Inspect document and redirect responses for CF-Cache-Status, X-LiteSpeed-Cache, or X-Cache. An excluded response shouldn’t become a cache HIT.
  4. Repeat after the cache is warm. One MISS doesn’t prove exclusion. Repeat the journey, then test another affiliate in a separate profile. Confirm visits, permitted test conversions, and portal information belong to the correct affiliate.

Developer Tools’ Disable cache setting affects browser caching, not your host or CDN cache.

Test both accepted and rejected consent choices. My guide to affiliate cookie consent explains why a missing cookie can reflect consent behavior rather than a caching fault. Don’t bypass consent controls to make a tracking test pass.

Frequently Asked Questions About WordPress Affiliate Link Caching

Will purging the cache interrupt an active campaign?

A normal page-cache purge removes stored responses, not visitors’ existing affiliate cookies. It also doesn’t delete referral records from your affiliate database.

Save your exclusions before purging. Then repeat a referral test, because an incorrect configuration can rebuild the same faulty cached response.

Why does a redirect still use an old destination?

Your browser may have stored a permanent redirect, even after the server cache was cleared. Test in a fresh profile and inspect the redirect response.

Changing a redirect to 302 doesn’t automatically prevent caching. The redirect endpoint still needs the appropriate bypass and response-header behavior.

Keep Your Speed Without Sacrificing Tracking

You don’t need to turn off caching site-wide to protect affiliate redirects. You need targeted exclusions wherever a cached response could skip tracking or expose private information.

Start with your busiest affiliate paths. Apply the URL, parameter, and cookie rules, clear existing entries, then test the complete journey before sending more paid traffic.


savings list for tools Builder by HBA Tell It What You Want. Watch It Build the Whole Funnel

Malcolm Keith

Thanks for visiting. My aim is to help aspiring online entrepreneurs build sustainable online income through affiliate marketing, traffic generation, and practical digital business strategies. I came online in 1999 using the internet to seek a replacement for my 9 to 5. It was a different world then ๐Ÿ˜‚ Finally had sufficient income to leave 'the job' in 2010 and now I continue to explore multiple streams of income and helping people join me along the way.

Leave a Reply