DEV Community

Cover image for Broken Links Are Costing You More Than You Think
Jonathan Pimperton
Jonathan Pimperton

Posted on • Originally published at sitevett.com

Broken Links Are Costing You More Than You Think

Broken Links Are Costing You More Than You Think

We all know that a good user experience is paramount. Visitors arrive at your site looking for information, a product, or a service. When they click a link and hit a 404 error, that’s not just an annoyance. It’s a dead end. For a WordPress agency, this directly impacts client satisfaction and can lead to lost business. For your own site, it’s a frustrating experience for potential customers and a clear signal to Google that your site isn’t well-maintained.

Broken links accumulate silently. A page is renamed. A post is deleted. A plugin's internal routing changes. These are common occurrences, especially in the dynamic world of WordPress development. The result is a growing list of untrustworthy links that erode authority and frustrate users.

Finding the Culprits: Beyond the Manual Click

Manually clicking through every link is impractical for anything beyond a small brochure site. You need automated tools.

Curl for Site-Wide Checks

The curl command-line tool, often used for transferring data, can be repurposed for link checking. While not a dedicated crawler, a simple script can fetch pages and check HTTP status codes. This is a good starting point for quick checks on smaller sites or for verifying specific sections.

A basic approach involves fetching each page and then parsing the HTML for <a> tags, checking the href attributes. However, curl itself doesn't recursively crawl. For a full crawl, we often combine it with other tools or shell scripting.

A more efficient curl-based approach for checking the current page's links, though not recursive:

curl -s https://yourdomain.com/ | grep -oP 'href="\K[^"]+' | while read url; do
  if [[ "$url" =~ ^/# ]]; then
    continue # Skip internal fragment links
  elif [[ "$url" =~ ^// ]]; then
    checked_url="https:$url"
  elif [[ "$url" =~ ^/ ]]; then
    checked_url="https://yourdomain.com$url"
  else
    checked_url="$url"
  fi
  status=$(curl -Is "$checked_url" | head -n 1 | awk '{print $2}')
  if [ "$status" != "200" ] && [ "$status" != "301" ] && [ "$status" != "302" ]; then
    echo "Broken link found: $checked_url (Status: $status)"
  fi
done
Enter fullscreen mode Exit fullscreen mode

This script fetches the homepage, extracts href attributes, resolves relative URLs, and checks their status. It's a rudimentary example and would need expansion for comprehensive crawling.

Browser Extensions for On-Page Audits

Browser extensions offer a more user-friendly and interactive way to find broken links, especially during development or for spot-checking specific pages.

  • Link Checker (Chrome/Firefox): This is a simple, effective extension. Once installed, navigate to a page on your site, activate the extension, and it will scan all the links on that page. It highlights broken links directly on the page and provides a report in a sidebar, showing the broken URL and its status code. It's excellent for quickly auditing content pages, blog posts, or landing pages.

  • Check My Links (Chrome): Similar to Link Checker, this extension scans a page and visually marks broken links with a red border. It’s very intuitive for identifying issues on the fly.

WordPress-Specific Pitfalls

In WordPress, certain actions are notorious for creating broken links if not handled carefully.

Permalink Changes

When you edit a post or page and change its slug (the part of the URL after the domain), the old URL will become a 404. WordPress itself doesn't automatically redirect the old URL to the new one unless you have a plugin that handles this.

Deleted Posts and Pages

The most obvious culprit: deleting a post or page. Any link pointing to that deleted content will break. If the deleted content was linked from other pages on your site or from external sites, those links become dead ends.

Plugin-Generated Pages or Links

Some plugins generate their own pages or manage links. If a plugin is deactivated, uninstalled, or its configuration is changed in a way that alters its URL structure, existing links to those generated pages can break. This is particularly common with e-commerce plugins, membership sites, or custom post type archives if the plugin's routing changes.

Internal vs. External Links

Remember that broken links can be internal (pointing to your own site) or external (pointing to another website). While you have more control over internal links, an external site changing its URL structure can also break links on your site. Tools will typically report both.

The Cost of Neglect

Beyond user frustration, Google sees broken links as a sign of a neglected website. This can negatively impact your search engine rankings. Every 404 is a missed opportunity to rank for that content and a potential loss of traffic. For agencies, recurring link audits should be a standard part of your maintenance packages. Identifying and fixing these issues proactively demonstrates diligence and enhances the perceived value of your services.

Regularly scanning your site with tools like Screaming Frog (a more powerful, desktop-based crawler) or using services like Ahrefs or SEMrush's site audit features can help maintain site health. For a more immediate, developer-centric approach, integrating these checks into your CI/CD pipeline, or even a simple post-deployment script, can catch many issues before they impact live users. Address them systematically: fix internal links by updating them to valid URLs, and for critical external links that have broken due to an external site's change, consider removing them or finding an alternative resource.


SiteVett checks this automatically as part of a free website QA scan with 60+ checks across security, SEO, content, performance, and more.

Top comments (0)