🌐 Web ScrapingPro Plan

CHECK_REDIRECT_CHAIN

Analyze the redirect chain for a URL, showing each hop with status codes.

Formula Signature
=CHECK_REDIRECT_CHAIN(url, [maxRedirects])

Returns: 2D array with columns: URL, Status, Redirects To

Overview

CHECK_REDIRECT_CHAIN traces the complete redirect path from a starting URL to its final destination, revealing every intermediate hop along the way. For each step in the chain, it reports the URL, the HTTP status code (301 permanent, 302 temporary, 307, 308, or others), and the URL it redirects to. The results are returned as a structured table with columns for URL, Status, and Redirects To, making it easy to visualize and analyze the entire chain at a glance.

Parameters

ParameterTypeRequiredDescription
urlstringYesThe starting URL to trace. Include the protocol (http:// or https://). Using http:// is useful for checking whether the site properly redirects to HTTPS.
maxRedirectsnumberNo (10)Optional. Maximum number of redirects to follow before stopping. Default is 10. Increase for sites with known long chains, or decrease to limit processing time.

Examples

1

Check HTTP to HTTPS redirect

Tests whether a site properly redirects from HTTP to HTTPS, showing each step in the redirect chain including any www/non-www normalization.

fx
=CHECK_REDIRECT_CHAIN("http://example.com")

Output

URLStatusRedirects To
http://example.com301https://example.com
https://example.com200Final destination
2

Trace a shortened URL to its destination

Follows a shortened URL through its redirect chain to reveal the final destination URL. Useful for verifying where short links actually point.

fx
=CHECK_REDIRECT_CHAIN("https://bit.ly/3xAbCdE")

Output

URLStatusRedirects To
https://bit.ly/3xAbCdE301https://example.com/landing-page?utm_source=twitter
https://example.com/landing-page?utm_source=twitter200Final destination
3

Audit a site migration redirect chain

Traces a URL from an old domain through its redirect chain to the new domain. Identifies multi-hop chains that should be consolidated into a single redirect.

fx
=CHECK_REDIRECT_CHAIN("https://old-site.com/blog/seo-guide")

Output

URLStatusRedirects To
https://old-site.com/blog/seo-guide301https://new-site.com/blog/seo-guide
https://new-site.com/blog/seo-guide301https://new-site.com/resources/seo-guide
https://new-site.com/resources/seo-guide200Final destination
4

Verify canonical URL redirects with limited hops

Checks the redirect chain with a maximum of 3 hops. If the chain exceeds 3 redirects, it stops and reports what it found, indicating the chain is too long.

fx
=CHECK_REDIRECT_CHAIN("https://example.com/page?ref=old", 3)

Output

URLStatusRedirects To
https://example.com/page?ref=old302https://example.com/page
https://example.com/page200Final destination

Use Cases

Web Development

Site Migration Validation

After migrating a website to a new domain or URL structure, validate that all old URLs redirect correctly to their new counterparts. Run CHECK_REDIRECT_CHAIN on a list of old URLs to verify each one reaches the correct destination with a 301 status code.

Digital Marketing

SEO Redirect Audit

Identify and fix redirect chains that waste link equity and slow down page loading. Audit all inbound links and internal links to find chains longer than one hop, then update the source to point directly to the final destination URL.

Affiliate Marketing

Affiliate Link Monitoring

Verify that affiliate tracking links redirect correctly through the tracking system to the merchant landing page. Detect broken affiliate links, incorrect tracking parameters, and changes in merchant URL structures that break the chain.

Brand Management

Brand Safety and Link Verification

Audit all shortened URLs and redirect links used in marketing campaigns to verify they lead to legitimate, brand-safe destinations. Identify any links that have been hijacked or modified to redirect to malicious or unauthorized pages.

Web Performance

Performance Optimization

Identify unnecessary redirect hops that add latency to page loads. Analyze redirect chains across the site to find and eliminate intermediate redirects, reducing time-to-first-byte for critical landing pages.

Security

HTTPS Migration Verification

After migrating a site from HTTP to HTTPS, verify that all HTTP URLs properly redirect to their HTTPS counterparts. Identify mixed-content issues where some resources still serve over HTTP or redirect inconsistently.

Pro Tips

TIP

Start your checks with http:// (not https://) to capture the full chain including the HTTP to HTTPS redirect, which is often the first hop and can reveal misconfigurations.

TIP

Run this function on all URLs from your Google Search Console or backlink reports to identify chains that waste link equity. Export the results and filter for chains with more than 2 hops to prioritize fixes.

TIP

After fixing redirect chains, re-run CHECK_REDIRECT_CHAIN to verify the fix. The ideal result is a single 301 redirect from the old URL directly to the final 200 destination.

TIP

Combine with GET_STATUS_CODE for a quick overview, and use CHECK_REDIRECT_CHAIN for detailed investigation of URLs that return 3xx status codes.

TIP

For large-scale audits, place your URL list in a column and use CHECK_REDIRECT_CHAIN in the adjacent column. Each call returns a multi-row result, so leave enough empty rows between entries or use separate sheets.

Redirect chains are a critical factor in both SEO and website performance. Search engines pass link equity (ranking power) through redirects, but long chains dilute that equity with each hop. A page redirecting through three or four intermediaries before reaching its destination loses significant ranking potential compared to a direct redirect. Google recommends keeping redirect chains as short as possible, ideally a single hop from the old URL to the new one.

From a performance perspective, each redirect adds latency to page load times. Every hop requires a new DNS lookup, TCP connection, and HTTP request, adding anywhere from 50ms to several hundred milliseconds per redirect. For users on mobile networks, long redirect chains can noticeably delay page loads and increase bounce rates.

CHECK_REDIRECT_CHAIN is invaluable during site migrations, where hundreds or thousands of URLs need to be redirected. It helps identify redirect loops (where URL A redirects to B, which redirects back to A), daisy chains from previous migrations that were never cleaned up, incorrect redirects that land on 404 pages, and mixed HTTP/HTTPS redirect issues. The maxRedirects parameter sets an upper limit on how many hops to follow, preventing infinite loops from hanging your spreadsheet.

This function is essential for SEO audits, site migration verification, link maintenance, and debugging URL routing issues across any website infrastructure.

Common Errors

Error: URL is required

Cause: The URL parameter is empty or missing.

Fix: Provide a complete URL including the protocol (http:// or https://). Check that the cell reference points to a non-empty cell.

Error: Too many redirects

Cause: The redirect chain exceeds the maxRedirects limit, which likely indicates a redirect loop or an excessively long chain.

Fix: Check for redirect loops by examining the returned chain for repeated URLs. If the chain is legitimately long, increase the maxRedirects parameter. If you see the same URLs cycling, fix the redirect configuration on the server.

Error: Failed to fetch URL

Cause: The starting URL is unreachable due to DNS failure, server downtime, SSL certificate errors, or network timeout.

Fix: Verify the URL is accessible in your browser. Check that the domain resolves correctly and the server is responding. For SSL errors, the domain may have an expired or misconfigured certificate.

Frequently Asked Questions

301 (Moved Permanently) indicates the URL has permanently moved to a new location; search engines transfer ranking signals to the new URL. 302 (Found/Temporary Redirect) indicates a temporary redirect; search engines may keep the original URL indexed. 307 (Temporary Redirect) is similar to 302 but preserves the HTTP method (POST stays POST). 308 (Permanent Redirect) is similar to 301 but preserves the HTTP method. 200 (OK) means the page loaded successfully and is the final destination. 404 (Not Found) at the end of a chain means the redirect leads to a broken page.

Google recommends keeping redirect chains to a single hop whenever possible. Two hops are acceptable in common scenarios (HTTP to HTTPS, then non-www to www). Three or more hops are generally considered excessive and should be consolidated. Google has stated they will follow up to 10 redirects before giving up, but each hop dilutes ranking signals and adds latency. As a rule of thumb, audit and fix any chain with 3 or more redirects.

A redirect loop occurs when URL A redirects to URL B, which redirects back to URL A (or through a longer circular chain). The browser or crawler gets stuck in an infinite loop until it gives up. CHECK_REDIRECT_CHAIN detects loops by tracking visited URLs and stops when it encounters a URL it has already seen, or when it hits the maxRedirects limit. If your results show the same URLs repeating or the chain hits the maximum without reaching a 200 status, you likely have a redirect loop.

Use 301 (permanent) redirects when a page has permanently moved to a new URL and you want search engines to transfer all ranking signals to the new location. Use 302 (temporary) redirects only when the redirect is genuinely temporary and you want the original URL to remain indexed. A common mistake is using 302 redirects for permanent changes, which can prevent search engines from properly transferring link equity to the new URL. If you see 302 redirects in your chain that should be permanent, update them to 301.

No. CHECK_REDIRECT_CHAIN follows server-side HTTP redirects (301, 302, 307, 308 status codes) only. It does not detect or follow client-side redirects implemented via JavaScript (window.location), meta refresh tags, or canonical tag mismatch redirects. For JavaScript-based redirects, you would need to use SCRAPE_BY_CSS_PATH or SCRAPE_BY_XPATH with JavaScript rendering enabled and check the final URL in the response.

The function follows HTTP redirects as they are returned by the server, regardless of whether the server is a CDN, load balancer, or origin server. CDN redirects (such as geographic redirects or edge-level redirects) are captured and shown in the chain. However, internal CDN routing that happens at the network level (without HTTP redirect responses) is invisible to the function, as it only tracks standard HTTP 3xx redirect responses.

Related Functions

Start using CHECK_REDIRECT_CHAIN today

Install Unlimited Sheets to get CHECK_REDIRECT_CHAIN and 41 other powerful functions in Google Sheets.