DEV Community

linkbruno.com
linkbruno.com

Posted on Edited on

How to fix 'Page with redirect' in Google Search Console (and when you shouldn't)

Scheduled broken-link and redirect checks that tell you the moment a link breaks — linkbruno.com

Open the Pages report in Google Search Console and you'll often find a grey row: Page with redirect, sometimes with hundreds or thousands of URLs. It's listed under "Why pages aren't indexed", which makes it look like a problem.

Most of the time it isn't. A URL that redirects shouldn't be indexed; the destination should. But the report is also one of the best places to find links on your own site that point at old URLs, and those are worth fixing. Here's how to tell which is which.

What the status means

Google requested the URL and got a redirect (301, 302, 307, 308, or a meta refresh or JavaScript redirect it detected). Google doesn't index the redirecting URL; it follows the redirect and considers the target instead.

So for a URL like http://example.com/pricing that redirects to https://example.com/pricing, "Page with redirect" is exactly the correct outcome.

When you can ignore it

These are normal and need no action:

  • HTTP to HTTPS, and non-www to www (or the reverse). Every site that has made either switch will have these.
  • Old URLs from a migration that now redirect to their new locations. That's what the redirects are for.
  • Trailing slash normalisation (/blog to /blog/).
  • Old URLs Google found long ago, through external links you don't control.

Google will keep re-crawling some of these occasionally, especially if other sites link to them. That's fine, and it's a good reason not to remove those redirects.

When it's worth fixing

Look at the examples in the report and ask: where did Google find this URL? If the answer is "on my own site", there's something to clean up.

1. Your sitemap lists URLs that redirect

A sitemap should only contain final, canonical URLs that return 200. If it lists http:// URLs, old slugs or URLs without the trailing slash your server adds, you're asking Google to crawl redirects. Regenerate the sitemap from the same source of truth that generates your canonical URLs.

2. Your internal links point at redirecting URLs

Navigation, footers, related-post widgets and in-content links written years ago often point at the old version of a URL. Each one costs an extra request for every crawler and every visitor, and long chains slow pages down. Update the links to point straight at the destination.

3. Canonical tags point at redirecting URLs

If a page's <link rel="canonical"> points to a URL that redirects, you're sending Google mixed signals: "the main version is X", and X says "go to Y". Canonical tags should point at the final URL.

4. The redirect goes somewhere wrong

Some entries reveal real bugs: product pages redirecting to the homepage, articles redirecting to a category page, or chains that end in a 404. Those URLs aren't just "not indexed", they're lost content. Fix the redirect target or restore the page.

Want a recurring check for redirect chains, not just a one-off export? linkbruno.com watches your links and flags the ones that now redirect, or redirect too many times.

A script to sort the list

Export the example URLs from the report (the Export button on the detail page), then check each one: where it ends up, how many hops it takes, and whether the final status is 200.

import csv, sys, requests

rows = list(csv.DictReader(open(sys.argv[1], encoding="utf-8")))
col = next(c for c in rows[0] if "URL" in c)  # export column is usually "URL"
s = requests.Session()
s.headers["User-Agent"] = "redirect-audit/1.0"

out = csv.writer(sys.stdout)
out.writerow(["url", "hops", "final_status", "final_url", "flag"])
for r in rows:
    url = r[col]
    try:
        resp = s.get(url, allow_redirects=True, timeout=20)
        hops = len(resp.history)
        flag = ""
        if resp.status_code != 200:
            flag = "BROKEN TARGET"
        elif hops > 1:
            flag = "CHAIN"
        elif resp.url.rstrip("/") in ("https://example.com", "http://example.com"):
            flag = "TO HOMEPAGE"
        out.writerow([url, hops, resp.status_code, resp.url, flag])
    except requests.RequestException as e:
        out.writerow([url, "", "ERR", type(e).__name__, "ERROR"])
Enter fullscreen mode Exit fullscreen mode

Replace example.com with your domain. Run it as python3 audit.py export.csv > result.csv and sort by the flag column. BROKEN TARGET, TO HOMEPAGE and CHAIN are the rows to work on. Everything else is a healthy single-hop redirect.

Then find where your own site links to them

For the rows that matter, search your own content and templates for the old URLs. A crawl of your site that records every internal link pointing at a redirect is the fastest way: most crawlers, including linkbruno.com, report redirecting links with the page that contains them. Fix the source pages, regenerate the sitemap, and then use "Validate fix" in Search Console if you like, although for this status it mainly confirms that Google has re-crawled the URLs.

Redirect types, briefly

While you're cleaning up, check which redirect status you're using. For permanent moves, use 301 or 308; Google treats both as a strong signal that the destination should replace the old URL. 302 and 307 say the move is temporary, so Google may keep the old URL indexed longer. Meta refresh and JavaScript redirects work, but are slower for Google to detect and less reliable for other crawlers. If your audit script shows lots of 302s for moves that were never temporary, switching them to 301 is a small server config change worth making at the same time.

Things not to do

  • Don't remove redirects to make the report shorter. A removed redirect turns "Page with redirect" into "Not found (404)" and breaks every external link to that URL.
  • Don't block redirecting URLs in robots.txt. Google then can't see the redirect at all, and the old URL may stay in the index longer.
  • Don't use "Remove URLs" for this. That tool temporarily hides URLs from results; it doesn't fix anything.
  • Don't panic about the count. Thousands of HTTP-to-HTTPS redirects on an old site is a normal number.

Related reading

How big is the "Page with redirect" row in your Search Console? And did checking it ever turn up a redirect that was quietly sending real pages to the homepage?

Top comments (0)