Skip to content

fix: 301 stale main-domain festival_wire sitemap URLs to wire subsite#71

Open
chubes4 wants to merge 1 commit into
mainfrom
issue-29-fw-sitemap
Open

fix: 301 stale main-domain festival_wire sitemap URLs to wire subsite#71
chubes4 wants to merge 1 commit into
mainfrom
issue-29-fw-sitemap

Conversation

@chubes4

@chubes4 chubes4 commented Jun 20, 2026

Copy link
Copy Markdown
Member

Root cause

The festival_wire CPT is registered by extrachill-news-wire, which is per-site active only on the wire subsite (blog 11, wire.extrachill.com). The main site (blog 1) has 0 festival_wire posts and never registers the CPT, so both:

  • https://extrachill.com/wp-sitemap-posts-festival_wire-1.xml
  • https://extrachill.com/wp-sitemap-posts-festival_wire-2.xml

return HTTP 404. Google retains these from a legacy era when Festival Wire lived on the main blog. The wire subsite serves them correctly (200) at https://wire.extrachill.com/wp-sitemap-posts-festival_wire-N.xml.

There was already a legacy-redirect handler for festival-wire content paths in inc/core/legacy-path-redirects.php (ec_handle_legacy_path_redirects() on template_redirect priority 1), but it did not cover the sitemap URLs.

Change

Extends the existing handler to also 301 the stale sitemap URLs on the main domain.

Regex → redirect mapping:

^/wp-sitemap-posts-festival_wire-(\d+)\.xml$
  → {wire_url}/wp-sitemap-posts-festival_wire-$1.xml  (301)
  • The page number $1 is passed through, so it works for any page count as wire grows (currently pages 1 and 2).
  • Uses the existing ec_get_site_url('wire') helper for the wire base — no hardcoded domain.
  • Guarded to the main blog only, mirroring the existing main-blog guard at the top of the function.
  • The $wire_url resolution was moved up a few lines so both the sitemap branch and the existing content-path branch share it. Behavior is equivalent: if ec_get_site_url('wire') is unavailable, neither redirect can function, so an early return for all paths is correct.

Verification

  • php -l clean.
  • phpcs --standard=WordPress clean (0 errors, 0 warnings).
  • Regex verified: matches /wp-sitemap-posts-festival_wire-1.xml and -2.xml (and multi-digit pages), captures the page number, and does not match the /festival-wire/* content path owned by the existing handler nor unrelated wp-sitemap-posts-post-N.xml URLs.

Fixes Extra-Chill/extrachill-seo#29

The festival_wire CPT is registered by extrachill-news-wire, which is
per-site active only on the wire subsite (blog 11). The main blog has
zero festival_wire posts and never registers the CPT, so both
wp-sitemap-posts-festival_wire-1.xml and -2.xml return HTTP 404 on the
main domain. Google retains these URLs from a legacy era when Festival
Wire lived on the main blog.

Extend ec_handle_legacy_path_redirects() to 301 any
^/wp-sitemap-posts-festival_wire-(\d+)\.xml$ on the main domain to the
matching URL on the wire subsite, reusing ec_get_site_url('wire') (no
hardcoded domain) and passing the page number through so it works for
any page count as wire grows.

Fixes Extra-Chill/extrachill-seo#29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Main-domain festival_wire sitemap 404s (wp-sitemap-posts-festival_wire-N.xml) — stale cross-site index leak

1 participant