Build Your Own Broken-Link SEO Checker

Build Your Own Broken-Link SEO Checker

willson

Learn how to build your own broken-link SEO checker to find broken URLs, detect 404 errors, analyze internal and external links, and improve website SEO performance.

Broken links are a common technical SEO problem that can negatively affect user experience and make website maintenance more difficult. When visitors click a link that leads to a missing page, they may encounter a 404 Not Found error or another connection issue. Search engine crawlers can also encounter these URLs while discovering and processing website content.

Building your own broken-link SEO checker is a practical way to automate link analysis, identify problematic URLs, and simplify technical SEO audits. Instead of manually checking every page, you can develop a tool that crawls website links, sends HTTP requests, records response codes, and generates a report of URLs that may need attention.

A custom checker can be built using Python and libraries such as Requests and Beautiful Soup. You can start with a simple script and gradually add advanced features, including internal-link analysis, external-link validation, CSV reports, crawl limits, and scheduled scans.

A broken-link SEO checker is a tool that scans website pages and tests their hyperlinks to identify URLs that fail to load correctly or return unexpected HTTP responses.

It can help website owners, developers, bloggers, and SEO professionals locate issues such as:

  • Internal links pointing to deleted pages.
  • External links leading to unavailable resources.
  • URLs returning 404 Not Found or 410 Gone responses.
  • Redirect chains and unnecessary redirects.
  • Links affected by server errors or connection timeouts.
  • Incorrect URL formats and malformed hyperlinks.

Not every unsuccessful request indicates a genuinely broken link. For example, a website may temporarily return a 503 Service Unavailable response or block automated requests. A good checker should record these cases separately and allow them to be reviewed.

A custom tool gives you greater control over how a website is crawled and how link problems are reported.

Key benefits include:

  1. Automated link auditing: Check hundreds or thousands of links without opening each URL manually.
  2. Improved user experience: Find links that lead visitors to missing or inaccessible resources.
  3. Technical SEO support: Identify internal linking problems and discover pages that may require updated destinations.
  4. Flexible reporting: Export results into CSV files for further analysis.
  5. Customizable crawling: Set crawl limits, request timeouts, and domain restrictions according to your requirements.
  6. Repeatable audits: Run scans regularly to detect newly introduced link problems.

A broken-link checker does not directly guarantee higher search rankings. Its value comes from helping you maintain useful links, improve navigation, and resolve technical problems that affect users and website crawling.

https://foromodelacion.cemieoceano.mx/showthread.php?tid=30606

https://www.ekdarun.com/forum/topic/236506/dostfilmsme

https://www.ekdarun.com/forum/topic/236030/tylebongdach

https://www.ekdarun.com/forum/topic/243678/hi880523com

https://forum.chainide.com/topic/33778/what-makes-a-crypto-brand-easier-to-evaluate

https://voluntarbv.ro/forum/discutii-generale/thread/520

https://voluntarbv.ro/forum/discutii-generale/thread/627

https://voluntarbv.ro/forum/discutii-generale/thread/664

http://www.ersterzug-hq.com/index.php/guestbook/index/index

https://www.milliescentedrocks.com/board/board_topic/2189097/9133438.htm

https://www.fw-follow.com/forum/topic/222658/pg99trade

https://www.fw-follow.com/forum/topic/222656/mu88agorg&p=2

https://www.fw-follow.com/forum/topic/222656/mu88agorg

https://www.fw-follow.com/forum/topic/231845/sc88

https://www.boygeorgefever.com/board/board_topic/9134313/9061074.htm

Step 1: Choose a Programming Language

Python is a practical choice for building a broken-link checker because it offers straightforward syntax and useful libraries for HTTP requests, HTML parsing, and data processing.

You can use the following libraries:

  • Requests: Sends HTTP requests and retrieves response status codes.
  • Beautiful Soup: Extracts hyperlinks from HTML documents.
  • urllib.parse: Resolves relative URLs and separates URL components.
  • CSV: Saves the audit results in a spreadsheet-compatible format.
  • Collections: Helps manage the URLs discovered during crawling.

Install the required packages by running this command in your terminal:

pip install requests beautifulsoup4

Make sure Python is installed before running the command.

Step 2: Define the Website and Crawl Rules

Before scanning a website, decide which pages the checker should visit and which links it should test.

For example, you may want to scan only pages on your own domain while also checking links that point to external websites.

Your initial configuration should include:

  • The starting website URL.
  • The maximum number of pages to crawl.
  • The request timeout.
  • The user-agent string.
  • The file format for the final report.
  • Rules for excluding unwanted URLs.

Respect the website's crawling policies, terms of service, and applicable robots.txt rules. Use conservative request rates to avoid putting unnecessary pressure on servers.

Step 3: Create a URL Collection System

A crawler needs to maintain a list of URLs that have already been discovered and a queue of pages waiting to be visited.

Using a queue and a set helps prevent duplicate crawling and keeps the process organized.

The basic workflow is:

  1. Add the starting URL to the queue.
  2. Retrieve the next URL.
  3. Check whether it has already been visited.
  4. Download the page if it is eligible for crawling.
  5. Extract links from the page.
  6. Add eligible internal pages to the queue.
  7. Continue until the queue is empty or the crawl limit is reached.

Normalize URLs carefully. For example, fragments such as #section generally do not need separate page requests, while query parameters may represent distinct resources and should not be removed indiscriminately.

Step 4: Extract Internal and External Links

Use Beautiful Soup to parse each HTML page and find its anchor elements.

A typical Python example looks like this:

from bs4 import BeautifulSoup
from urllib.parse import urljoin, urldefrag

def extract_links(html, page_url):
    soup = BeautifulSoup(html, "html.parser")
    links = set()

    for tag in soup.find_all("a", href=True):
        absolute_url = urljoin(page_url, tag["href"])
        clean_url, _ = urldefrag(absolute_url)

        if clean_url.startswith(("http://", "https://")):
            links.add(clean_url)

    return links

This function converts relative links into absolute URLs and removes URL fragments before returning the results.

For example, a link such as /contact/ on https://example.com becomes https://example.com/contact/.

You can then compare each URL's hostname with your target domain to distinguish internal links from external links.

Step 5: Send HTTP Requests and Check Status Codes

After extracting links, send HTTP requests to check whether each destination responds successfully.

The following example demonstrates a basic URL-checking function:

import requests

def check_url(url):
    try:
        response = requests.get(
            url,
            timeout=10,
            allow_redirects=True,
            headers={
                "User-Agent": "CustomSEOChecker/1.0"
            },
            stream=True
        )

        result = {
            "url": url,
            "status_code": response.status_code,
            "final_url": response.url,
            "content_type": response.headers.get(
                "Content-Type", ""
            )
        }

        response.close()
        return result

    except requests.RequestException as error:
        return {
            "url": url,
            "status_code": "REQUEST_ERROR",
            "final_url": "",
            "content_type": "",
            "error": str(error)
        }

This function records the response code and the final URL after redirects. It also captures request errors separately.

Common responses include:

  • 200 OK: The request succeeded.
  • 301 or 302: The resource redirects to another URL.
  • 403 Forbidden: Access is denied.
  • 404 Not Found: The requested resource cannot be found.
  • 410 Gone: The resource is reported as permanently removed.
  • 429 Too Many Requests: The server is limiting requests.
  • 500 Internal Server Error: The server encountered an error.
  • 503 Service Unavailable: The service is temporarily unavailable.

A checker should not automatically classify every non-200 response as a broken link. Redirects can be valid, access restrictions may affect automated requests, and temporary server errors should be rechecked before being marked as confirmed issues.

Step 6: Build the Main Crawling Logic

Combine the URL queue, link extraction, and HTTP checks into a crawler.

Your main crawling function should:

  1. Fetch an eligible page.
  2. Record its HTTP response.
  3. Parse the HTML if the response is suitable for processing.
  4. Extract internal and external links.
  5. Add new internal pages to the crawl queue.
  6. Check discovered links according to your chosen policy.
  7. Store the results in a structured collection.

For a first version, you can limit the crawler to a small number of pages. Once the results are accurate, add features such as domain normalization, retries, concurrency limits, and duplicate-link tracking.

Important: Avoid crawling arbitrary URLs without safeguards. Restrict the tool to authorized targets, validate URLs before making requests, and block requests to private, loopback, link-local, and other sensitive network addresses. This is particularly important if you later turn the script into a public web application.

Step 7: Classify Broken Links

A useful SEO checker should organize results into categories rather than simply displaying a list of failed requests.

Consider creating the following classifications:

  • Confirmed missing pages: URLs returning 404 or 410 responses.
  • Redirected URLs: Links that lead to another destination.
  • Server errors: URLs returning 5xx responses.
  • Access restrictions: URLs returning 401, 403, or similar responses.
  • Request failures: Timeouts, DNS errors, TLS errors, and connection failures.
  • Successful links: URLs that respond as expected.

For better accuracy, retry temporary failures after a reasonable delay and record the timestamp of each check. You can also flag redirect chains and internal links that point to redirecting URLs.

Step 8: Export Results to a CSV Report

CSV reporting makes it easier to review findings in spreadsheet applications and share them with developers or SEO teams.

Useful report columns include:

ColumnPurposeSource URLPage containing the linkDestination URLURL being checkedLink TypeInternal or externalHTTP StatusResponse code or error categoryFinal URLDestination after redirectsContent TypeType of returned resourceError DetailsAdditional request informationLast CheckedDate and time of the auditThe source URL is especially important. Without it, you may know that a destination is broken but not which pages need to be updated.

For a basic export, use Python's built-in CSV module:

import csv

def export_report(results, filename="broken_links.csv"):
    fields = [
        "source_url",
        "url",
        "status_code",
        "final_url",
        "content_type",
        "error"
    ]

    with open(
        filename,
        "w",
        newline="",
        encoding="utf-8"
    ) as file:
        writer = csv.DictWriter(
            file,
            fieldnames=fields,
            extrasaction="ignore"
        )
        writer.writeheader()
        writer.writerows(results)

Each result should contain the appropriate fields before being passed to this function. You can filter the report to show only confirmed problems or export all results for a complete audit.

Step 9: Test the Checker on a Small Website

Before running a large crawl, test the tool on a website you own or have permission to audit.

Verify that it can:

  • Identify normal HTML pages.
  • Detect missing internal pages.
  • Follow redirects correctly.
  • Record external-link failures.
  • Handle timeouts without crashing.
  • Avoid revisiting the same page repeatedly.
  • Generate a readable CSV report.

Compare a sample of the results with manual browser checks. Some websites behave differently toward automated clients, so verification helps reduce false positives.

Step 10: Schedule Regular Link Audits

Once the checker works correctly, automate recurring scans using a scheduled task, such as Windows Task Scheduler or cron on Linux.

The ideal frequency depends on how often the website changes. A frequently updated ecommerce website may benefit from more frequent checks than a small static website.

Store previous reports so that you can compare results over time. This allows you to identify newly broken links, confirm that repaired URLs are working, and prioritize recurring issues.

A reliable custom checker should include the following features.

1. Automated Website Crawling

The tool discovers internal pages and hyperlinks without requiring manual URL entry for every page.

2. HTTP Status-Code Detection

It records server responses to help identify missing pages, redirects, access restrictions, and server errors.

3. Internal and External Link Analysis

It distinguishes links within the target website from links pointing to other domains.

4. Redirect Tracking

It records final destinations and identifies opportunities to update internal links that unnecessarily pass through redirects.

5. CSV Export

It creates structured reports that can be reviewed, filtered, shared, and compared over time.

6. Crawl Limits and Request Timeouts

It prevents scans from running indefinitely and helps manage server load.

7. Duplicate URL Prevention

It avoids wasting resources by revisiting pages that have already been processed.

8. Error Categorization

It separates confirmed missing pages from temporary failures and access-related issues.

9. Source-Page Identification

It identifies the page containing each problematic link, making it easier to fix the correct hyperlink.

10. Scheduled Monitoring

It supports recurring scans and helps teams detect newly introduced link problems.

Follow these recommendations to make the tool more useful and reliable:

  • Use a clear user-agent string that identifies your crawler.
  • Respect crawl policies and use conservative request rates.
  • Set sensible connection and read timeouts.
  • Limit retries to avoid excessive requests.
  • Handle redirects explicitly and record the final URL.
  • Avoid crawling session-specific, duplicate, or irrelevant URLs unnecessarily.
  • Validate destinations before making network requests.
  • Keep separate records for temporary failures and confirmed broken links.
  • Protect the tool from unsafe URL inputs if it accepts user-submitted websites.
  • Store audit history so you can measure whether repairs are successful.

For larger websites, consider using a database to store crawl results and adding a dashboard to filter findings by status code, source page, and link type.

Frequently Asked Questions (FAQs)

1. What is a broken-link SEO checker?

A broken-link SEO checker is a tool that scans website pages and tests hyperlinks to find missing pages, inaccessible destinations, redirects, and other link-related issues. It helps website owners maintain working navigation and perform technical SEO audits.

2. Can I build a broken-link checker using Python?

Yes. Python is suitable for building a custom checker using Requests for HTTP requests, Beautiful Soup for HTML parsing, and CSV for exporting reports. You can expand the script with crawling, classification, and monitoring features.

3. How does a broken-link checker identify 404 errors?

The checker sends a request to a destination URL and examines the HTTP response. If the server returns a 404 status code, the tool records that response and can flag the URL for verification.

4. Do broken links directly affect Google rankings?

Broken links do not automatically cause a ranking penalty. However, they can frustrate users, interrupt navigation, and make useful content harder to discover. Fixing important broken internal links is a practical part of maintaining website quality and crawlability.

https://facare.vn/boards/topic/95105/commande-naltrexone-ldn-naltrexone-and-autism

https://facare.vn/boards/topic/991234/understanding-krnl-executor-features-and-functions

https://facare.vn/boards/topic/33260/acheter-sildalis-pas-cher-prix-sildalis

https://facare.vn/boards/topic/1229748/adderall-in-deutschland-ohne-rezept-kaufen

https://facare.vn/boards/topic/1121070/can-you-cancel-an-allegiant-airlines-flight

https://facare.vn/boards/topic/674327/alli-senza-ricetta-alli-orlistat-senza-ricetta

https://facare.vn/boards/topic/369290/kopa-atomoxetine-kopa-nu-kopa-atomoxetine-torsk

https://www.ontime.co.th/forum/topic/989030/ae888

https://www.ontime.co.th/forum/topic/990656/bk8gamemy

https://www.ontime.co.th/forum/topic/978569/mc16win

https://www.bangyaimaterial.com/forum/topic/233285/ww88studio

https://www.bangyaimaterial.com/forum/topic/241202/sunwin789zacom

https://www.bangyaimaterial.com/forum/topic/238177/u888educom01

5. What is the difference between internal and external broken links?

An internal broken link points to a missing or inaccessible resource on the same website. An external broken link points to a resource on another domain that is unavailable or inaccessible. Both can affect the user experience, but internal links are generally easier for website owners to repair directly.

Conclusion

Building your own broken-link SEO checker is a useful technical SEO project that combines web crawling, HTTP requests, HTML parsing, and automated reporting. With Python and a few practical libraries, you can create a tool that discovers links, checks response codes, identifies potential problems, and exports actionable results.

Start with a simple crawler, test it on a small website, and gradually add features such as redirect tracking, error categorization, CSV reporting, and scheduled scans. Remember to distinguish confirmed broken links from temporary failures and verify important findings before making changes

Report Page