Skip to content
FunnelGuard

Fix guide by FunnelsGuard

fbclid/gclid causing 404 or WAF block on landing pages: fix

TRK-322High impactDetectedBy FunnelGuardPublished Updated
On this page

What this issue is

Ad platforms add a click ID to your link when someone clicks an ad. Google adds gclid, Meta adds fbclid. They are long strings of letters, numbers, dashes and underscores, often 60 to 100+ characters. You never type them, so you may never test with them.

Some setups treat that long, random query string as a problem. A security rule may read it as an attack. A rewrite rule may fail to match the URL. A framework route may not expect extra parameters. The page then returns a 404 (not found), 403 (forbidden) or a challenge page, but only for paid visitors.

Where a paid click breaks
  1. Ad clickPlatform appends ?gclid= or ?fbclid=
  2. Request reaches CDN/WAFRule rejects the query string
  3. Landing pageNever served; visitor sees 404 or 403
  4. Form or checkoutNever reached
  5. Conversion trackingNo tag fires

The ad click is fine. The page request with the click ID is rejected, so every later step is lost.

Why it costs you leads or sales

You pay for the click, and the visitor gets an error. Because the error only appears with click IDs, organic visits, direct visits and your own checks all look fine. The problem can run for weeks without anyone noticing.

It also hurts the numbers. The ad platform sees clicks but no conversions, and bidding algorithms may learn from poor results. Your analytics may show almost no sessions from the campaign, so the traffic looks like a low-quality source when the real fault is on your side.

Ad clicks versus landing page loadsExample numbers
Ad clicks versus landing page loads (example)Clicks paid for: 1,000 visits; Pages loaded (broken): 120 visits; Pages loaded (fixed): 960 visits03837671,000120960Clicks paid forPages loaded (broken)Pages loaded (fixed)visits

Example: 1,000 paid clicks where the landing page rejects the click ID, compared with the same clicks after the rule is fixed.

How to check if your site has it

Compare your clean URL with the same URL carrying a realistic click ID. Do it in a private window and also with curl, so browser cache and cookies do not hide the result.

Compare status codes with and without click IDsbash
# Clean URL
curl -s -o /dev/null -w "%{http_code}\n" "https://example.com/landing-page/"

# With a Google click ID
curl -s -o /dev/null -w "%{http_code}\n" "https://example.com/landing-page/?gclid=Cj0KCQiA_test1234567890abcdefghijklmnopqrstuvwxyz_ABCDEFGHIJ"

# With a Meta click ID
curl -s -o /dev/null -w "%{http_code}\n" "https://example.com/landing-page/?fbclid=IwAR0test1234567890abcdefghijklmnopqrstuvwxyz_ABCDEFGHIJ"

If the clean URL returns 200 and the click ID versions return 404, 403, 406 or 429, you have this issue. Also try a browser user agent, because some rules look at it:

Repeat with a browser user agentbash
curl -s -o /dev/null -w "%{http_code}\n" -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 Chrome/120 Safari/537.36" "https://example.com/landing-page/?gclid=test_1234567890abcdefghijklmnopqrstuvwxyz"
What each response usually points to
ResponseLikely causeWhere to look
404 only with click IDRewrite rule or app route does not allow the query string.htaccess, nginx config, framework router, CMS redirect plugin
403 or 406WAF or ModSecurity rule matched the parameter valueHosting firewall log, Cloudflare Security Events, Sucuri, Wordfence
Challenge or block pageBot or rate rule triggered by ad trafficCDN security rules and rate limits
429Rate limit hit by bursts of ad clicksCDN or server rate limiting

How to fix it

Fix the rejection
  1. Find the rule that fires

    Check the firewall or server log for the blocked request. Look for the rule ID, the matched parameter (gclid or fbclid) and the status code.

  2. Allow the click ID parameters

    Add an exception for query parameters named gclid, fbclid, msclkid, ttclid, li_fat_id and utm_* so they are not inspected or rejected. Do not turn the firewall off.

  3. Make routing ignore unknown parameters

    Rewrite and redirect rules should match the path only. Make sure the query string is passed through instead of causing a no-match.

  4. Purge caches

    Clear CDN and server cache so error responses that were cached for these URLs are not served again.

  5. Retest with real-looking IDs

    Run the curl commands again and then click a test ad or a preview link.

Where to change it on your platform
  1. Check security plugins

    In Wordfence, Sucuri, iThemes or similar, open the firewall or blocked-requests log and look for entries on your landing URL. Allowlist the rule or the parameter.

  2. Check redirect and cache plugins

    In redirect plugins (Redirection, Rank Math, Yoast Premium) look for regex rules that match the full URL. In cache plugins, check the 'ignore query strings' list and add gclid and fbclid.

  3. Ask your host about ModSecurity

    If the log shows a ModSecurity rule ID, ask the host to whitelist that rule for your domain.

nginx: pass the query string throughnginx
location / {
    try_files $uri $uri/ /index.php?$args;
}
Apache: keep the query string on rewriteshtaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php [QSA,L]

How to confirm it's fixed

Confirmation checks
  • curl returns 200 for the URL with a fake gclid
  • curl returns 200 for the URL with a fake fbclid
  • The page works with both parameters together and with UTMs added
  • The final URL in the browser still shows the click ID after load
  • The firewall log shows no new blocks for these requests
  • The conversion tag fires on the landing page when opened with a click ID

How to prevent it happening again

These faults come back when someone changes security settings, adds a redirect plugin or moves the site behind a new CDN. Build a check into those changes.

Habits that stop a repeat
  • After any WAF, CDN, hosting or redirect change, test landing pages with a fake gclid and fbclid
  • Keep a short allowlist note of the parameters your ads use
  • Write redirect rules against the path, not the full URL
  • Review firewall logs for blocks on landing pages after each campaign launch
  • Test every new landing page with click IDs before sending paid traffic

How FunnelGuard handles this

FunnelGuard detects this issue today. Its robot visitor runs a synthetic ad arrival: it opens your landing page the way a paid click would, with a click ID and campaign parameters, and checks that the page loads instead of returning a 404 or a block. Test traffic is marked (utm_source=funnelguard, fg_test=1, an fg_test cookie and its own user agent) and never clicks real ads.

If the arrival fails, FunnelGuard re-checks from a second region, then sends one alert by email, Slack, Teams, WhatsApp, webhook or PagerDuty with a screenshot and a likely cause. It does not bypass CAPTCHAs or bot protection, so if your WAF challenges the marked test visitor, you may need to allow its user agent. The Free plan covers 1 site and 2 journeys with daily checks and no card, and a free read-only website audit is available.

Questions people ask

Why does my landing page show a 404 only when people come from ads?

The ad platform adds a click ID such as gclid or fbclid to the URL. A rewrite rule, router or security rule may not handle that extra query string, so it returns a 404 while the clean URL works. Test both versions with curl to confirm.

Why is my WAF blocking gclid or fbclid?

Click IDs are long random strings, and some WAF rules treat that pattern as suspicious input. Check the firewall log for the rule ID, then add an exception for those parameter names. Keep the rest of the firewall on.

How do I test if fbclid breaks my page?

Open your landing page URL with ?fbclid= and a long made-up value, in a private window or with curl. Compare the status code with the clean URL. A 200 on the clean URL and an error on the other means the click ID is being rejected.

Does Cloudflare block gclid parameters?

Not by default for most sites, but managed rules, custom rules, rate limits or bot settings can block requests that carry them. Look in Security > Events for the rule that fired and create a skip or exception for it.

Should I strip gclid and fbclid from my URLs to fix the error?

No. Stripping them can hide the error but breaks attribution and conversion matching in the ad platforms. Fix the rule that rejects them so the parameters reach the page.

Can a caching plugin cause a 404 with click IDs?

Yes. Some cache or redirect setups mishandle query strings or cache an error for a URL that has parameters. Add gclid and fbclid to the ignored query strings list, purge the cache and retest.

How can I be alerted if ad clicks start failing?

A synthetic check that opens your landing page with a click ID on a schedule will catch it. FunnelGuard runs this kind of ad arrival check and alerts you with a screenshot and a likely cause.

Does FunnelGuard catch this?

Detected

FunnelGuard checks for this today.

How: synthetic ad arrival.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.