# Redirect Path Analyzer (`zerobreak/redirect-path-analyzer`) Actor

Redirect path analyzer that follows every hop in a URL chain and reports status codes, redirect types, and the final destination, so SEO teams can fix broken chains before they affect rankings.

- **URL**: https://apify.com/zerobreak/redirect-path-analyzer.md
- **Developed by:** [ZeroBreak](https://apify.com/zerobreak) (community)
- **Categories:** SEO tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.99 / 1,000 results

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?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Redirect Path Analyzer: Trace URL Redirect Chains and Audit HTTP Hops

Redirect Path Analyzer follows every hop in a URL's redirect chain and reports the full route to the final destination. Give it one URL or a list, and you get back each intermediate step with its HTTP status code, redirect type (301, 302, 303, 307, 308), and the final landing page. Good for SEO teams checking site migrations or anyone who needs to know the exact path a URL takes before it resolves.

### Use cases

- **Site migration audits**: check that every old URL redirects to its new location after a domain move or rebuild
- **SEO health checks**: find redirect chains longer than three hops, which slow load times and dilute link equity
- **Redirect loop detection**: catch circular chains before they cause errors in browsers
- **Pre-launch QA**: confirm all planned redirects work before going live
- **Bulk URL checking**: audit hundreds of URLs at once and export results to a spreadsheet

### Input

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `url` | string | | A single URL to analyze. |
| `urls` | array | | List of URLs to analyze, one per line. Use for bulk audits. |
| `maxUrls` | integer | 100 | Maximum number of URLs to process per run. |
| `maxRedirects` | integer | 20 | Max redirect hops to follow per URL before stopping. |
| `requestTimeoutSecs` | integer | 30 | Timeout in seconds for each HTTP request. |
| `timeoutSecs` | integer | 300 | Overall actor run timeout in seconds. |
| `proxyConfiguration` | object | Datacenter (Anywhere) | Proxy type and location for requests. Optional. |

#### Example input

```json
{
    "urls": [
        "https://apify.com/pricing",
        "https://apify.com/blog"
    ],
    "maxUrls": 100,
    "maxRedirects": 20,
    "requestTimeoutSecs": 30,
    "proxyConfiguration": { "useApifyProxy": true }
}
```

### What data does this actor extract?

One result per input URL. Each result contains:

```json
{
    "inputUrl": "https://apify.com/pricing",
    "finalUrl": "https://apify.com/pricing",
    "redirectCount": 0,
    "finalStatusCode": 200,
    "isRedirectLoop": false,
    "hops": [
        {
            "url": "https://apify.com/pricing",
            "statusCode": 200,
            "redirectLocation": null
        }
    ],
    "scrapedAt": "2025-03-08T12:00:00.000Z"
}
```

| Field | Type | Description |
|-------|------|-------------|
| `inputUrl` | string | The original URL submitted. |
| `finalUrl` | string | The final destination URL after all redirects. |
| `redirectCount` | integer | Number of redirect hops in the chain. |
| `finalStatusCode` | integer | HTTP status code of the final destination. |
| `isRedirectLoop` | boolean | True if a circular redirect was detected. |
| `hops` | array | Each hop in the chain with URL, status code, and redirect location header. |
| `scrapedAt` | string | ISO 8601 timestamp of the analysis. |

### How it works

1. Reads the input URL or URL list.
2. For each URL, sends an HTTP GET request without following redirects automatically.
3. If the response is a 301, 302, 303, 307, or 308, it follows the Location header to the next URL.
4. Repeats until a non-redirect response arrives, a loop is detected, or the max redirect limit is hit.
5. Saves the full chain, final URL, redirect count, and status codes to the dataset.

### Integrations

Connect Redirect Path Analyzer with other apps using [Apify integrations](https://apify.com/integrations). Export directly to Google Sheets, push results to Slack, trigger Zapier workflows, or sync with Airbyte. You can also use [webhooks](https://docs.apify.com/integrations/webhooks) to trigger actions whenever results are ready.

### FAQ

**How many URLs can I check per run?**
Up to 1,000 per run (set via `maxUrls`). For larger audits, split your list across multiple runs.

**Can it detect redirect loops?**
Yes. It tracks every URL visited and sets `isRedirectLoop: true` if a URL appears twice in the same chain.

**What redirect types does it handle?**
HTTP 301, 302, 303, 307, and 308. Meta refresh and JavaScript redirects are not followed since those require a browser.

**Does it follow redirects across domains?**
Yes. It resolves relative redirect locations and follows cross-domain chains the same way a browser would.

**Do I need proxies?**
Most sites do not block this kind of traffic, so proxies are optional. If a site throttles repeated requests, enable Datacenter proxies in the proxy configuration.

Run Redirect Path Analyzer before a migration or after a domain change to get a clear picture of how your URLs actually route to their destinations.

# Actor input Schema

## `url` (type: `string`):

A single URL to analyze for redirects.

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

List of URLs to analyze. Enter one URL per line.

## `maxUrls` (type: `integer`):

Maximum number of URLs to process per run. Caps the total across both 'URL' and 'URLs' inputs.

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

Maximum number of redirect hops to follow for a single URL before stopping. Prevents runaway chains.

## `requestTimeoutSecs` (type: `integer`):

Timeout in seconds for each individual HTTP request.

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

Overall actor run timeout in seconds.

## `proxyConfiguration` (type: `object`):

Select proxies to use for requests. Helps avoid IP blocking and rate limits. Datacenter proxies are fastest; Residential proxies are harder to detect.

## Actor input object example

```json
{
  "url": "https://apify.com/",
  "urls": [
    "https://apify.com/",
    "https://docs.python.org/3/"
  ],
  "maxUrls": 100,
  "maxRedirects": 20,
  "requestTimeoutSecs": 30,
  "timeoutSecs": 300,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# 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 = {
    "url": "https://apify.com/",
    "maxUrls": 100,
    "maxRedirects": 20,
    "requestTimeoutSecs": 30,
    "timeoutSecs": 300,
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("zerobreak/redirect-path-analyzer").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 = {
    "url": "https://apify.com/",
    "maxUrls": 100,
    "maxRedirects": 20,
    "requestTimeoutSecs": 30,
    "timeoutSecs": 300,
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("zerobreak/redirect-path-analyzer").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 '{
  "url": "https://apify.com/",
  "maxUrls": 100,
  "maxRedirects": 20,
  "requestTimeoutSecs": 30,
  "timeoutSecs": 300,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call zerobreak/redirect-path-analyzer --silent --output-dataset

```

## MCP server setup

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

```

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/AknczjG8BnwIN8yGI/builds/pkadJ2K9809r39UE1/openapi.json
