Cloudflare Pages Silently Ignores 410 Status in _redirects — Here's the Fix
A developer relaunched a domain that previously hosted a WordPress site, causing Google Search Console to flag numerous 404 errors for old WordPress-style URLs still indexed by search engines. To properly signal that this content no longer exists, the developer attempted to configure 410 Gone responses using Cloudflare Pages' _redirects file, only to find the rules were silently ignored. Cloudflare Pages' _redirects supports only five redirect status codes — 301, 302, 303, 307, and 308 — making 410 and other non-redirect codes invalid without any warning. The workaround is to create a Cloudflare Pages Function at functions/[[path]].js that intercepts matching URL patterns and returns a proper 410 response, passing all other requests through to static assets. Cloudflare Pages automatically detects the functions directory at the project root, requiring no additional configuration.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in