# Find Broken Links & Redirect Chains on Any Website (`craigmckee/site-link-auditor`) Actor

Broken links frustrate visitors. Point this at your site and get a page-by-page hit list of 404s, broken images, redirect chains and loops, mixed content and noindex pages, with the exact page each problem lives on. Robots.txt respected.

- **URL**: https://apify.com/craigmckee/site-link-auditor.md
- **Developed by:** [Print & Plan UK](https://apify.com/craigmckee) (community)
- **Categories:** SEO tools, Developer tools
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$2.00 / 1,000 page auditeds

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

## Find Broken Links & Redirect Chains on Any Website

**What it does:** crawls a website and finds everything that's broken, by Print & Plan UK. **You give it:** one or more start URLs, plus optional page limit, depth and whether to check external links. **You get:** a page-by-page report of broken links (404s, 5xx, DNS errors, timeouts), broken images and scripts, redirect chains and loops, mixed content and noindex pages, plus a site summary listing every broken URL and the pages it appears on. **Cost per run:** $0.002 per page crawled (all link checks on that page included), so a 100-page site costs $0.20; robots-blocked or failed pages are free. **Example inputs:** `http://www.deadlinkcity.com/`, `https://books.toscrape.com/`, `https://www.example.com/`.

Built for SEO specialists, agencies, webmasters and anyone migrating a site.

### Features

- **Internal and external link checks**, including images, scripts, stylesheets, iframes and media.
- **Full redirect chains**, e.g. `301 → 302 → 200`, and redirects to dead pages (`301 → 404`), the classic SEO leak.
- **"Blocked" vs "broken"**: 401/403/429/999 responses (bot protection, logins) are reported separately so they don't pollute your broken-link list.
- **Mixed-content detection** on HTTPS pages.
- **On-page SEO basics**: title, canonical, noindex (meta and X-Robots-Tag), H1 count, response time.
- **Polite by design**: obeys robots.txt and Crawl-delay, sets per-host concurrency and delay limits, uses no proxies and never logs in.
- **Budget-aware**: if you set a maximum cost per run, the crawl size is capped up front, so you never pay for work that can't be delivered.

### Input example

```json
{
  "startUrls": ["http://www.deadlinkcity.com/"],
  "maxPages": 100,
  "maxDepth": 10,
  "checkExternalLinks": true,
  "checkResources": true,
  "excludeUrlPatterns": ["/cart", "\\?sort="]
}
```

### Output

One **page** item per crawled page, plus one **summary** item (also saved as `SUMMARY` in the key-value store).

```json
{
  "type": "page",
  "url": "http://www.deadlinkcity.com/",
  "statusCode": 200,
  "title": "Example Errors - Benchmark Site for Dead Link Checking Tools",
  "linksFound": 55,
  "brokenCount": 43,
  "brokenLinks": [
    {"url": "http://www.deadlinkcity.com/default.asp?r=4", "kind": "link", "anchorText": "301 redirection to an invalid link",
     "status": 404, "internal": true, "finalUrl": "http://www.deadlinkcity.com/nosuchpage2.txt", "chain": [301, 404]},
    {"url": "http://www.deadlinkcity.com/error-page.asp?e=400", "kind": "link", "anchorText": "Errorcode 400", "status": 400, "internal": true}
  ],
  "redirectedLinks": [
    {"url": "http://www.deadlinkcity.com/default.asp?r=1", "finalUrl": "http://www.deadlinkcity.com/valid-page.asp", "hops": 1, "chain": [301, 200]}
  ],
  "blockedLinks": [{"url": "http://www.deadlinkcity.com/error-page.asp?e=403", "anchorText": "Errorcode 403", "status": 403, "internal": true}],
  "mixedContent": [],
  "noindex": false
}
```

```json
{
  "type": "summary",
  "pagesCrawled": 4,
  "uniqueUrlsChecked": 57,
  "uniqueBrokenUrls": 43,
  "pagesWithBrokenLinks": 1,
  "brokenUrls": [{"url": "http://www.deadlinkcity.com/error-page.asp?e=417", "status": 417, "foundOn": ["http://www.deadlinkcity.com/"]}]
}
```

### Pricing (pay per event)

| Event | Price |
|---|---|
| Page audited (all link checks on that page included) | $0.002 |

A 500-page site costs about $1. External link checks are included in the page price. Pages that fail or are disallowed by robots.txt are not charged, and the summary item is free.

### FAQ

**Will it hammer my server?** No. Default concurrency is 4 per host with a 0.25 s minimum gap between requests, and a robots.txt Crawl-delay is honoured if it's larger.

**Does it render JavaScript?** No. It reads the server HTML, which is what search engines index first. JS-only links (SPAs) may be missed.

**Should I only audit sites I own?** Yes, please audit your own sites or clients' sites. The crawler identifies itself in its User-Agent and respects robots.txt.

### More tools from this developer

- [Bulk Domain Intel (RDAP)](https://apify.com/craigmckee/domain-intel-rdap): domain age, expiry, registrar, DNS and an SPF/DMARC/DKIM grade.
- [Website Tech Stack Detector](https://apify.com/craigmckee/tech-stack-detector): CMS, ecommerce, analytics and CDN, with evidence for each detection.
- [Wayback Machine Change Tracker](https://apify.com/craigmckee/wayback-change-tracker): capture history and a text diff between archived versions.
- [Document to Markdown + RAG chunks](https://apify.com/craigmckee/document-to-markdown): PDF, Word, PowerPoint and Excel to Markdown and RAG-ready chunks.

# Actor input Schema

## `startUrls` (type: `array`):

Homepage (or any page) of the site to audit. The crawler stays on the same host (and its www/non-www twin).

## `maxPages` (type: `integer`):

Maximum number of HTML pages crawled on your site. You are charged per page crawled; link checks are included.

## `maxDepth` (type: `integer`):

How many clicks away from the start URL to follow.

## `checkExternalLinks` (type: `boolean`):

Also check links pointing to other websites (one HEAD/GET request per unique URL, robots.txt respected).

## `checkResources` (type: `boolean`):

Check embedded resources too, and flag mixed content (http resources on https pages).

## `includeSubdomains` (type: `boolean`):

Treat subdomains (e.g. blog.example.com) as part of the site.

## `excludeUrlPatterns` (type: `array`):

Links matching any of these regular expressions are neither crawled nor checked, e.g. `/cart`, `\?sort=`.

## `includeAllLinks` (type: `boolean`):

Also list links that returned 2xx (larger output). By default only problems are listed.

## `maxConcurrency` (type: `integer`):

Parallel requests per host. Keep this low to be polite.

## `minDelaySecs` (type: `number`):

A robots.txt Crawl-delay, if larger, takes precedence.

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

Timeout per request. Links timing out are reported as broken.

## Actor input object example

```json
{
  "startUrls": [
    "https://books.toscrape.com/"
  ],
  "maxPages": 10,
  "maxDepth": 10,
  "checkExternalLinks": true,
  "checkResources": true,
  "includeSubdomains": false,
  "excludeUrlPatterns": [],
  "includeAllLinks": false,
  "maxConcurrency": 4,
  "minDelaySecs": 0.25,
  "requestTimeoutSecs": 20
}
```

# Actor output Schema

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

No description

# 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 = {
    "startUrls": [
        "https://books.toscrape.com/"
    ],
    "maxPages": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("craigmckee/site-link-auditor").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 = {
    "startUrls": ["https://books.toscrape.com/"],
    "maxPages": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("craigmckee/site-link-auditor").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 '{
  "startUrls": [
    "https://books.toscrape.com/"
  ],
  "maxPages": 10
}' |
apify call craigmckee/site-link-auditor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,craigmckee/site-link-auditor"
        }
    }
}
```

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/6ubddXhxtpOnIVIVv/builds/gVVrDicUQsepYFb2S/openapi.json
