# Redirect Chain Checker – Bulk URL Status for SEO Migrations (`adamplaenitz/redirect-chain-checker`) Actor

Trace every redirect hop of many URLs: status, Location, response time, final URL, loops, HTTPS up/downgrades, www changes, meta refresh, canonical of the final page. Optional expected target per URL to verify SEO migrations.

- **URL**: https://apify.com/adamplaenitz/redirect-chain-checker.md
- **Developed by:** [Adam Plänitz](https://apify.com/adamplaenitz) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 url checkeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Redirect Chain Checker – Bulk URL Status for SEO Migrations

**Trace every redirect hop of hundreds or thousands of URLs: status code, Location header and response time of each hop, the final URL and status, loops, HTTPS upgrades and downgrades, www changes, meta refresh redirects and the canonical URL of the final page.** Add the expected target per URL and the Actor tells you which redirects of a site migration are wrong. Export as JSON, CSV or Excel, or connect to Google Sheets, Make, Zapier, n8n or webhooks.

### What does it do?

For every URL the Actor follows the redirects itself, hop by hop (no browser needed):

- **Every hop:** URL, status code (301, 302, 303, 307, 308 …), raw `Location` header, resolved target, redirect type, response time, `Server` header and certificate errors.
- **Result:** final URL, final status, number of redirects, list of status codes (`301 > 301 > 200`), total time and a `status`: `ok`, `redirect`, `broken` (final 4xx/5xx or 3xx without Location), `loop`, `too-many-redirects`, `redirect-error` (a redirect target is unreachable) or `error`.
- **Flags:** loop, mixed http/https, **HTTPS upgrade**, **HTTPS downgrade**, **www added / removed**, host changed, temporary redirects (302/303/307), meta refresh.
- **Meta refresh and Refresh header** (`<meta http-equiv="refresh" content="0; url=…">`) are followed as hops (optional; refreshes inside `<noscript>` and comments are ignored, a refresh to the same page is not a redirect).
- **Canonical:** `<link rel="canonical">` or the canonical `Link` header of the final page and whether it matches the final URL (optional).
- **Migration check:** write `old-url -> expected-new-url` (or paste two columns from a spreadsheet, separated by a tab) and get `matchesExpected` for every row.
- **SEO issues with recommendations:** loops, too many hops, broken targets, HTTPS → HTTP downgrades, chains with more than one hop, meta-refresh redirects, temporary redirects for permanent moves, canonical mismatch, unexpected targets, invalid certificates.

### Who is it for?

- **SEO specialists and agencies** validating redirect maps before and after a site migration, relaunch or domain move.
- **Developers and DevOps** testing redirect rules (nginx, Apache, CDN, load balancer) in CI or after deployments.
- **Content and marketing teams** checking backlinks, campaign links and short links for broken or long chains.

### Input

| Field | Default | Description |
|---|---|---|
| URLs | – | One per line; optional expected target: `https://old.example.com/a -> https://www.example.com/a`. |
| Maximum redirects | 10 | 1–30 hops. |
| Follow meta refresh / Refresh header | on | Reads at most 256 KB of HTML pages. |
| Read the canonical URL | on | Of the final page. |
| Scheme for entries without http(s):// | https | Use `http` to see the HTTP → HTTPS hop for bare domains. |
| Request method | GET | `HEAD` is lighter (falls back to GET if rejected) but cannot see meta refresh / canonical. |
| User-Agent | Actor UA | Optional custom User-Agent. |
| Parallel checks | 10 | 1–50. |
| Timeout per hop | 15 s | Connection resets are retried. |

### Output example

```json
{
  "input": "http://www.apify.com",
  "url": "http://www.apify.com/",
  "status": "redirect",
  "finalUrl": "https://apify.com/",
  "finalStatus": 200,
  "redirectCount": 2,
  "statusCodes": [301, 301, 200],
  "loop": false,
  "mixedProtocols": true,
  "httpsUpgrade": true,
  "httpsDowngrade": false,
  "wwwChange": "removed",
  "hostChanged": false,
  "temporaryRedirect": false,
  "metaRefresh": false,
  "canonicalUrl": "https://apify.com/",
  "canonicalSource": "html",
  "canonicalMatchesFinal": true,
  "expectedUrl": "https://apify.com/",
  "matchesExpected": true,
  "issueSummary": "multiple_hops",
  "hops": [
    { "url": "http://www.apify.com/", "statusCode": 301, "location": "https://www.apify.com:443/", "redirectTo": "https://www.apify.com/", "redirectType": "http-301", "responseTimeMs": 228, "server": "awselb/2.0", "tlsError": null },
    { "url": "https://www.apify.com/", "statusCode": 301, "location": "https://apify.com:443/", "redirectTo": "https://apify.com/", "redirectType": "http-301", "responseTimeMs": 345, "server": "awselb/2.0", "tlsError": null },
    { "url": "https://apify.com/", "statusCode": 200, "location": null, "redirectTo": null, "redirectType": null, "responseTimeMs": 440, "server": null, "tlsError": null }
  ],
  "issues": [
    { "severity": "medium", "code": "multiple_hops", "message": "2 redirects before the final URL – each hop costs time and may lose link equity.", "recommendation": "Redirect the original URL directly to the final URL (one hop)." }
  ],
  "totalTimeMs": 1207,
  "checkedAt": "2026-11-12T11:45:06.922Z",
  "error": null
}
```

Meta-refresh hops have `redirectType: "meta-refresh"` (or `"refresh-header"`) and `refreshDelaySecs`. The **Overview** table shows URL, result, final status and URL, number of redirects, status codes, issues, HTTPS up/downgrade, www change, meta refresh, canonical, expected target and time.

### Pricing and speed

See the **Pricing** tab. You pay per checked URL; **rows for URLs whose first request fails (DNS error, timeout, connection refused, invalid input) are free**. Broken targets, 404s, loops and unreachable redirect targets are results and are charged. Duplicates are removed before checking.

Each hop is one request (redirect responses are not downloaded; final HTML pages up to 256 KB). Locally, 31 mixed URLs took about 5 seconds. In a cloud test with the default 10 parallel checks, the Tranco top 1,000 domains (about 30 % of them infrastructure domains without a reachable website, which wait for the timeout) took about 5 minutes. For large lists, raise *Parallel checks* or lower the timeout. The Actor runs with 256 MB memory. You can set a maximum cost per run – the Actor stops cleanly when it is reached.

### Privacy and responsible use

- **Passive check:** normal page requests like a browser visit (no JavaScript execution, no form submissions, no login attempts, no port scanning).
- **Please check only sites you own or are allowed to assess.** Results are technical indicators, not a guarantee of search-engine behaviour.
- No cookies are stored or sent between hops; no personal data is collected. Private, loopback and internal addresses are refused.

### Limits

- JavaScript redirects (`window.location`) are not executed – only HTTP redirects, the Refresh header and meta refresh.
- Each hop uses a fresh connection, so response times include DNS, TCP and TLS setup.
- Some sites answer automated clients differently (bot protection, geo or language redirects). Use a custom User-Agent if needed; requests come from Apify cloud servers.
- Cookies are not carried between hops; sites that require a cookie to stop redirecting may show a loop.

Questions or feature requests? Please open an issue in the **Issues** tab.

# Actor input Schema

## `urls` (type: `array`):

One URL per line. To verify a migration, add the expected final URL: 'https://old.example.com/a -> https://www.example.com/a' (also '=>' or a tab, e.g. pasted from a spreadsheet). Bare domains get the default scheme. Duplicates are removed. Only check sites you own or are allowed to assess.

## `maxRedirects` (type: `integer`):

Stop following after this many hops (status 'too-many-redirects').

## `detectMetaRefresh` (type: `boolean`):

Treat <meta http-equiv="refresh" content="0; url=..."> and the Refresh HTTP header as redirect hops (reads up to 256 KB of HTML pages; not available with HEAD).

## `extractCanonical` (type: `boolean`):

Reports <link rel="canonical"> (or the canonical Link header) of the final page and whether it matches the final URL.

## `defaultScheme` (type: `string`):

'http' shows the full chain including the HTTP → HTTPS redirect; 'https' starts directly with HTTPS.

## `method` (type: `string`):

GET (default, most accurate; the page body is only read for HTML pages, max 256 KB) or HEAD (lighter, falls back to GET when the server rejects HEAD; no meta refresh / canonical).

## `userAgent` (type: `string`):

Leave empty to identify as 'redirect-chain-checker/0.1 (Apify Actor; link checker)'. Some sites redirect bots or mobile browsers differently.

## `concurrency` (type: `integer`):

How many URLs are traced at the same time (1–50).

## `timeoutSecs` (type: `integer`):

Maximum time per request. Connection resets are retried automatically.

## Actor input object example

```json
{
  "urls": [
    "http://apify.com",
    "http://github.com",
    "http://wikipedia.org",
    "https://example.com"
  ],
  "maxRedirects": 10,
  "detectMetaRefresh": true,
  "extractCanonical": true,
  "defaultScheme": "https",
  "method": "GET",
  "concurrency": 10,
  "timeoutSecs": 15
}
```

# Actor output Schema

## `results` (type: `string`):

One item per URL with every hop, the final URL and status, flags and SEO issues.

## `summary` (type: `string`):

Counts per status, errors, duplicates and charged results.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "urls": [
        "http://apify.com",
        "http://github.com",
        "http://wikipedia.org",
        "https://example.com"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("adamplaenitz/redirect-chain-checker").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "urls": [
        "http://apify.com",
        "http://github.com",
        "http://wikipedia.org",
        "https://example.com",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("adamplaenitz/redirect-chain-checker").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "urls": [
    "http://apify.com",
    "http://github.com",
    "http://wikipedia.org",
    "https://example.com"
  ]
}' |
apify call adamplaenitz/redirect-chain-checker --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,adamplaenitz/redirect-chain-checker"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/NlRvLh1HUhFiLhc8E/builds/IjyqAzzRtIiYPddWa/openapi.json
