Skip to Content

Redirects using the wrong status code

What Is This Issue

A redirect is a server instruction that automatically forwards users and crawlers from one URL to another. This issue checks whether redirects on your website are properly configured, including identifying redirect chains, loops, broken destinations, wrong status codes, and client-side redirects.

A passing implementation requires:

  • Direct redirects (single hop) from source to destination
  • Correct HTTP status codes (301 for permanent moves, 302 for temporary)
  • No redirect loops (A → B → A)
  • No excessive redirect chains (A → B → C → D)
  • Working destination URLs that return 200 OK
  • HTTP URLs redirecting to HTTPS
  • Server-side redirects instead of meta refresh or JavaScript redirects

Example: A properly configured redirect from http://example.com to https://example.com using a 301 status code.

Why Is This Important

Redirects are critical for SEO because they:

  • Affect Crawlability: Search engines follow redirects, but each hop consumes crawl budget and increases latency
  • Impact Rankings: Redirect chains dilute link equity, reducing the SEO value passed to the destination page
  • Affect User Experience: Multiple redirects slow down page loading times
  • Prevent Indexation Issues: Broken redirects or redirect loops can make pages unindexable

Poorly configured redirects can waste crawl budget, dilute link equity, and degrade user experience. This directly impacts your SEO health score by affecting how search engines discover and value your content.

How XeoPix Detects This

XeoPix performs comprehensive redirect analysis through the following logical steps:

  1. Redirect Discovery: XeoPix crawls all known URLs and captures the initial HTTP status code and Location header without following redirects automatically.

  2. Hop-by-Hop Following: For each 3xx response, XeoPix resolves the Location header and follows the redirect, counting each hop and recording the complete chain.

  3. Loop Detection: XeoPix checks if any URL appears more than once in the redirect chain, indicating a loop.

  4. Chain Analysis: XeoPix counts the total number of hops and flags chains with 3 or more redirects as excessive.

  5. Destination Validation: XeoPix checks the final destination URL to ensure it returns a 200 OK status code.

  6. HTTPS Verification: XeoPix verifies that all HTTP URLs redirect to HTTPS.

  7. Client-Side Detection: XeoPix parses HTML for <meta http-equiv="refresh"> tags that indicate client-side redirects.

  8. Issue Identification: XeoPix raises issues when:

    • Redirect loops are detected (CRITICAL)
    • Redirect chains have 3+ hops (WARNING)
    • Redirect destinations are broken (CRITICAL)
    • HTTP doesn’t redirect to HTTPS (WARNING)
    • Client-side redirects are used (WARNING)
    • Obsolete redirects are found (SUGGESTION)

How To Fix

  1. Flatten redirect chains: If you have a chain (A → B → C), update the redirect to point directly from A to C.

  2. Fix redirect loops: Identify and remove rules that create circular redirects (A → B → A).

  3. Use correct status codes: Use 301 redirects for permanent moves and 302 for temporary redirects.

  4. Ensure HTTPS: Configure HTTP URLs to redirect to HTTPS using 301 redirects.

  5. Fix broken destinations: Ensure redirect destinations return 200 OK and aren’t 404 or 500 errors.

  6. Replace client-side redirects: Convert meta refresh or JavaScript redirects to server-side HTTP redirects.

  7. Update internal links: Point internal links directly to the final destination URL instead of redirecting URLs.

  8. Clean up obsolete redirects: Remove redirects that no longer receive traffic or are no longer needed.

What We Store

Storage Level

Page Level — This issue is evaluated for each individual URL that returns a redirect.


Database Table / Prisma Model

RedirectChain


Stored Fields

FieldTypeDescription
originalUrlStringThe original URL that was requested
finalUrlStringThe final URL after all redirects
chainJsonArray of all redirect hops (URLs and status codes)
chainLengthIntNumber of redirects in the chain
hasLoopBooleanWhether the redirect chain contains a loop

Detection Dependencies

  • The following data sources are required to evaluate this issue:
  • HTTP Response — The crawler follows redirect responses (301, 302, 303, 307, 308)
  • Redirect Chain — All intermediate URLs and status codes are captured
  • Final URL — The destination URL after all redirects are followed

Examples

Example 1: Redirect Chain

Problematic State (Fails): A redirect chain with multiple hops:

http://example.com → https://example.com → https://www.example.com → https://www.example.com/home

This wastes crawl budget and dilutes link equity.

Corrected State (Passes): Redirect directly to the final destination:

http://example.com → https://www.example.com/home

Example 2: Redirect Loop

Problematic State (Fails): A circular redirect loop:

https://example.com/page-a → https://example.com/page-b → https://example.com/page-a

This creates an infinite loop that browsers and crawlers cannot resolve.

Corrected State (Passes): Remove the circular reference and redirect to a valid page:

https://example.com/page-a → https://example.com/page-c

Example 3: Client-Side Redirect

Problematic State (Fails): Using meta refresh for redirects:

<meta http-equiv="refresh" content="0;url=https://example.com/new-page" />

Corrected State (Passes): Use server-side HTTP redirect instead (configure your web server to return):

HTTP/1.1 301 Moved Permanently Location: https://example.com/new-page

Unit Test

Test File

xeopix-crawling-v2/__tests__/seo-audit-checks/crawlBehaviour/issue-8-all-redirects-place.test.js

Purpose

This unit test file is a placeholder for the future implementation of the ALL_REDIRECTS_PLACE feature. The entire test suite is skipped (describe.skip). The tests assert against local mock variables and do not call any production code, providing no regression value until the feature is implemented.

Tested Function

None — the feature is not yet implemented in production code. The tests reference placeholder logic only.

Issue Information

  • Issue Number: 8
  • Issue Code: ALL_REDIRECTS_PLACE
  • Toggle Group: crawlBehaviour

Test Scenarios

Positive Test Cases

  • Pages with proper redirects → no redirect issues detected (placeholder mock)

Negative Test Cases

  • Redirect chain exceeds recommended length (6 hops) → issue detected (placeholder mock)
  • Temporary redirects (302) used instead of permanent (301) → issue detected (placeholder mock)
  • Redirect loops detected → isLoop is true with loop URLs identified (placeholder mock)

Boundary Cases

  • Redirect chain exactly at threshold length (3 hops) → recognized as at threshold (placeholder mock)

Edge Cases

  • Pages with no redirects (direct 200) → no issue triggered (placeholder mock)
  • Multiple redirect chains in a single scan → all issues detected correctly (placeholder mock)

Expected Outcome

Pass

An ALL_REDIRECTS_PLACE issue is not reported when redirects are properly configured with correct status codes and reasonable chain lengths.

Fail

An ALL_REDIRECTS_PLACE issue is reported when:

  • Redirect chains exceed the recommended length
  • Temporary redirects (302) are used for permanently moved pages
  • Redirect loops are detected

Validation

The test suite is currently skipped. It validates only placeholder mock data structures. No production code is exercised.

  • xeopix-crawling-v2/toggleGroups/crawlBehaviour.js (has TODO comments for this feature)
  • xeopix-crawling-v2/issueCodes.js

Coverage Summary

  • 7 placeholder test cases, all skipped
  • Tests cover redirect chain length, status code correctness, loop detection, and multiple chains
  • No production code is tested — the suite must be enabled and rewritten once the feature is implemented
  • The ALL_REDIRECTS_PLACE issue code exists in issueCodes.js but the detection logic is not yet implemented

References

Last updated on