Blog Sections Open

Why Pages Return 404 on the First Request and 200 on the Second

If a page fails on the first request but works immediately after, the problem is usually in routing, cache warmup, or server-level rewrite behavior rather than in the template itself.

A particularly confusing production symptom is this: a page returns 404 Not Found on the first request, but then returns 200 OK when requested again. That usually points to an infrastructure or routing edge case, not to random content corruption.

Typical Causes to Check

  • rewrite rules that behave differently before a cache file exists
  • host-level caching or proxy layers that warm up incorrectly
  • timing issues around friendly URL resolution
  • custom plugins that mutate routing state during the first uncached hit

Why Bots Notice It Faster Than People

The original topic mentioned reproducing the pattern through Googlebot checks. Crawlers hit URLs cold and systematically, so they expose first-request failures much more clearly than a human tester who refreshes pages manually and unknowingly benefits from a warmed cache.

How to Investigate It

  • compare server logs for the first and second hit
  • test with cache disabled temporarily
  • review .htaccess, nginx rewrites, and canonical redirects
  • check whether the URL is being generated differently from the routed alias on first access

This kind of issue is easy to misread as “random 404s”, but the first-vs-second request pattern is a strong clue. Start with rewrite logic and cache interaction before changing content or manager settings.

Newer post

Speeding Up Search on Large Evolution CMS Sites

How one large-site AjaxSearch setup was improved by narrowing whereSearch and moving TV lookup into withTvs instead of scanning every TV field.

Older post

Fixing Container Links That Generate with a Trailing Slash Instead of .html

Why some Evolution-generated links point to container-style paths and how to bring them back in line with the URL pattern your site expects.