Blog

Website Redirects and Security: What Can Go Wrong

← Back to blog
2026-04-17·5 min readRedirectsWeb Security

Why redirects matter for security

Redirects are everywhere on the web. HTTP to HTTPS, www to non-www, old URLs to new ones. Most are harmless, but misconfigured redirects create real security vulnerabilities.

The three biggest risks are open redirects, redirect chains that bypass HTTPS, and loops that break availability.

Open redirects

An open redirect is a URL on your site that accepts a destination parameter and redirects the user to any URL, including external malicious sites.

https://yoursite.com/redirect?url=https://evil.com

Attackers use open redirects in phishing campaigns. The link starts with your trusted domain, so users and email filters are less likely to flag it.

How to fix open redirects

  • Validate the destination against an allow-list of approved domains
  • Use relative paths instead of full URLs
  • Never pass user-controlled input directly to a redirect without validation
  • Audit your application for redirect endpoints that accept URL parameters
  • Redirect chains

    A redirect chain is when one redirect leads to another, which leads to another. Each hop adds latency and creates a window where the connection might not be encrypted.

    A dangerous pattern:

    http://example.com > http://www.example.com > https://www.example.com

    The first two hops are over plain HTTP. An attacker can intercept traffic at either point. The safe pattern redirects to HTTPS in the first hop:

    http://example.com > https://www.example.com

    How to fix redirect chains

  • Ensure every redirect goes to the final HTTPS destination in a single hop
  • Remove intermediate redirects that serve no purpose
  • Enable HSTS to eliminate HTTP-to-HTTPS redirects after the first visit
  • Test redirect behavior from both HTTP and HTTPS entry points
  • HTTP-to-HTTPS redirect issues

    The HTTP-to-HTTPS redirect is the most important redirect on your site. Getting it wrong creates a permanent vulnerability.

    Common mistakes:

  • Not redirecting at all - HTTP version serves content without encryption
  • Redirecting to HTTP first - http://site.com redirects to http://www.site.com before HTTPS
  • Missing redirect on subdomains - www redirects to HTTPS but api.site.com does not
  • 301 vs 302 - use 301 (permanent) for HTTP-to-HTTPS so browsers cache the redirect
  • Redirect loops

    A redirect loop occurs when page A redirects to page B, which redirects back to page A. Browsers detect this after a few hops and show an error page.

    Common causes:

  • CDN or proxy adds HTTPS redirect, but the origin also redirects
  • Server config redirects www to non-www while DNS or CDN redirects non-www to www
  • Application-level redirect conflicts with server-level redirect
  • How to audit your redirects

    Use cqwerty's Redirect Checker to trace the full redirect chain for any URL. It shows every hop, the status code, and whether each connection uses HTTPS.

    Key takeaways

  • Open redirects are a phishing vector; validate all redirect destinations
  • Minimize redirect chains to reduce latency and HTTP exposure
  • Always redirect to the final HTTPS URL in a single hop
  • Test redirects from every entry point (HTTP, HTTPS, www, non-www)
  • Check your redirects now

    Ready to check your domain?

    A graded scan across six surfaces in about 2 minutes. Free, no signup required.

    Check your redirects