Why Is My Redirect Not Working? 10 Common Fixes

Developer troubleshooting a broken website redirect between two browser pages

A redirect should send visitors and search engines from one URL to another, but several small issues can stop it from working. The rule may be in the wrong configuration file, the source URL may not match the actual request, or a cache may keep serving an older response. Redirect chains, conflicting plugins, HTTPS settings, and incorrect status codes can also create unexpected results.

If you are asking, “why is my redirect not working,” the quickest route to an answer is to inspect the HTTP response before changing more settings. A redirect that looks broken in a browser may actually be working at the server level but pointing to the wrong destination. In other cases, the server returns a normal 200 response, proving that the redirect rule was never applied.

This article explains how to identify those differences, test a redirect accurately, and fix the most common problems across Apache, Nginx, WordPress, domain settings, and application code. You will also learn how query strings, trailing slashes, redirect loops, DNS, CDNs, and caching affect redirects so you can solve the underlying problem instead of repeatedly rewriting the same rule.

Why Redirects Fail

A redirect works only when the incoming request matches a rule and the system responsible for that rule processes it. If either condition fails, the visitor may remain on the original URL, reach a 404 page, or receive an unexpected destination.

The most common causes are incorrect URL matching, configuration placement, cached responses, conflicting rules, and confusion about which service controls the request. A redirect entered in WordPress cannot help if a CDN redirects the request before it reaches WordPress.

A redirect also involves more than two visible URLs. The browser may first contact a CDN, load balancer, web server, application framework, and content management system. Any layer can return a redirect or override one created farther down the request path.

Start With the HTTP Response

The browser address bar shows the final result, but it does not explain how the request got there. Inspecting the HTTP response reveals whether the source URL returns a redirect status, where it points, and whether multiple redirects occur along the way.

Use a command-line request to test the headers:

curl -I https://example.com/old-page

A working permanent redirect might return:

HTTP/2 301

location: https://example.com/new-page

A temporary redirect might use 302, 307, or 308 instead. If the response is 200, the server served content rather than redirecting the request. A 404 suggests the request reached a handler that could not find the resource.

To follow the entire route, use:

curl -IL https://example.com/old-page

This displays each response in sequence. It can expose an HTTP-to-HTTPS redirect, a www-to-non-www redirect, a trailing-slash normalization, and the final page response. Browser developer tools provide similar information under the Network panel when “Preserve log” is enabled.

Quick Redirect Diagnosis Checklist

  • Confirm the exact source URL, including the protocol, hostname, path, letter case, query string, and trailing slash.
  • Test both HTTP and HTTPS versions when both may receive traffic.
  • Check the status code without following redirects automatically.
  • Inspect the Location header for an incorrect domain, path, or protocol.
  • Follow the complete redirect path to find chains and loops.
  • Test in a private browser window to reduce browser-cache interference.
  • Purge relevant CDN, proxy, server, plugin, and application caches.
  • Confirm which system receives the request first.
  • Check that the destination URL loads without redirecting back.
  • Review server or application logs if the rule still does not match.

Incorrect Source URL Matching

A redirect rule must match the URL in the form seen by the system processing it. A rule for /old-page may not match /old-page/, /Old-Page, or /old-page?ref=email, depending on the server, platform, and matching method.

Hostnames matter too. The addresses example.com, www.example.com, shop.example.com, and an internationalized domain variant are separate hosts. If the source host is not connected to the same server or redirect service, a path-level rule on the main website will never run.

Regular expressions add another source of errors. Characters such as dots, question marks, parentheses, and slashes can have special meanings. A pattern may be too narrow and miss valid requests, or too broad and redirect URLs that were never intended to move.

Test with the precise URL copied from a real request, backlink, analytics report, or search result. Do not rely on how you remember the address. A single slash, encoded character, or hostname difference can change which rule applies.

Rule Order and Configuration Placement

Redirect rules are normally evaluated in a defined order. A broad rule placed above a specific one may capture the request first. For example, a site-wide HTTP-to-HTTPS rule can interact with a later domain migration rule and produce an unnecessary hop.

Placement is equally important. An Apache rule added outside the active virtual host or in an .htaccess file that Apache is not allowed to read will have no effect. An Nginx rule placed in the wrong server block may never receive the intended hostname.

Application-level redirects run only after the request reaches the application. That makes them unsuitable for some domain, protocol, and missing-file cases. Server-level or edge-level rules are usually earlier, faster, and easier to apply consistently during a full-site migration.

When several systems can redirect traffic, choose one clear owner for each task. For example, let the CDN enforce HTTPS, let the web server handle legacy paths, and let the application manage redirects based on user state. Documenting that ownership reduces conflicts.

Practical Rule-Ordering Example

Consider a site moving from old.example.com to example.com while also enforcing HTTPS.

Poor sequence:

1. Redirect http://old.example.com/page to https://old.example.com/page.

2. Redirect https://old.example.com/page to https://example.com/page.

3. Add a trailing slash at https://example.com/page/.

The visitor passes through three responses before reaching the page.

Better sequence:

1. Match every protocol and path on old.example.com.

2. Send the request directly to https://example.com/page/.

3. Return the final page with a 200 response.

A direct mapping saves requests, reduces latency, and makes the migration easier for search engines to process.

Browser, CDN, and Server Caching

Redirects are cacheable responses. Browsers can remember permanent redirects aggressively, which means an old 301 may continue to affect tests after you change the server. Testing in another browser or private window helps, although it does not eliminate every cache layer.

CDNs, reverse proxies, managed hosting platforms, WordPress plugins, and application frameworks may also cache redirects. Purging only the page cache is not always enough because some systems store redirects separately from HTML responses.

Check the live response with curl or another HTTP client that is not using your browser history. If that result differs from the browser, local caching is a likely cause. If both show an old response, inspect upstream caches and the active server configuration.

During development, use temporary redirects when appropriate so revisions are easier to test. Switch to the intended permanent status only after confirming the source, destination, and redirect path. Do not use a temporary redirect indefinitely for a migration intended to remain permanent.

Redirect Loops and Too Many Redirects Errors

A loop occurs when one URL redirects back to itself, directly or indirectly. The simplest example sends URL A to URL B while another rule sends URL B back to URL A. Browsers eventually stop and report too many redirects.

Protocol and hostname rules frequently cause loops behind reverse proxies. A load balancer may terminate HTTPS and send an internal HTTP request to the origin. If the origin assumes the visitor used HTTP, it redirects to HTTPS again on every request.

WordPress address settings can create similar behavior when the configured site URL conflicts with a proxy, plugin, or web-server rule. Mixed www and non-www settings are another frequent cause, especially when different layers enforce opposite hostname versions.

Trace the entire chain and write down every Location value in order. The last unique URL before repetition usually identifies the conflicting rule. Fix the disagreement rather than raising redirect limits, since a loop can never reach valid content.

Common Redirect Loop Patterns

  • HTTP redirects to HTTPS, but the origin does not recognize the proxy’s forwarded protocol.
  • The CDN enforces www while the server removes www.
  • A WordPress plugin redirects to one domain while the WordPress Address setting uses another.
  • A trailing-slash rule adds a slash while an application route removes it.
  • A language or location rule alternates between two regional URLs.
  • An authentication rule sends users to a login page that redirects unauthenticated users back.
  • URL A redirects to URL B while an old migration rule still sends URL B to URL A.

Status Codes and Their Effects

Not every 3xx response behaves the same way. A 301 signals a permanent move, while a 302 generally represents a temporary destination. A 307 preserves the request method for temporary redirects, and a 308 preserves it for permanent redirects.

Method preservation matters for forms, API calls, and file uploads. Historically, clients have often changed a POST request into a GET after a 301 or 302. A 307 or 308 is safer when the destination must receive the original method and request body.

Meta refresh tags and JavaScript navigation are not equivalent to server-side HTTP redirects. They require the page to load first, may fail when scripts are blocked, and provide less predictable behavior for crawlers and accessibility tools.

For ordinary page migrations, server-side 301 redirects are usually appropriate. Temporary campaigns, maintenance routes, and short-lived experiments may call for 302 or 307 responses. See [Internal Link: HTTP Status Codes Explained] for a closer comparison of response behavior.

Redirect Status Code Comparison

Status code | Typical purpose | Method handling | Common use

301 | Permanent move | May change POST to GET in some clients | Moved pages and long-term URL changes

302 | Temporary move | May change POST to GET in some clients | Short-lived alternate pages

307 | Temporary move | Preserves method and body | Temporary API or form routing

308 | Permanent move | Preserves method and body | Permanent API or method-sensitive migration

200 | Successful content response | No redirect occurs | Final destination page

404 | Resource not found | No redirect occurs | Missing source or destination

410 | Resource intentionally removed | No redirect occurs | Content removed without a replacement

Apache Redirect Problems

Apache redirects are commonly configured with mod_alias Redirect directives or mod_rewrite rules. Mixing both without a clear order can cause surprising results because they have different matching behavior and processing rules.

An .htaccess file works only when the server permits directory overrides. If AllowOverride is disabled, Apache ignores the file. A syntax error may also generate a server error rather than a failed redirect, so check the Apache error log after configuration changes.

In .htaccess, RewriteRule patterns usually match the URL path without a leading slash. A rule written as ^/old-page$ may therefore fail, while ^old-page/?$ can match both slash variants when placed in the relevant document root.

A basic permanent redirect using mod_rewrite may look like

RewriteEngine On

RewriteRule ^old-page/?$ /new-page/ [R=301,L]

Test configuration changes before reloading Apache when you have server access. Also confirm that the rewrite module is enabled and that no earlier virtual-host rule captures the request.

Nginx Redirect Problems

Nginx does not use .htaccess files. Adding or editing one has no effect on an Nginx-only server. Redirects must appear in the active Nginx configuration, a hosting control panel that generates it, or another system in front of Nginx.

The server_name and listen directives determine which server block handles a request. A valid return directive in the wrong block will not run. Default server blocks can also capture requests for unrecognized hostnames.

A direct permanent redirect can be written as:

return 301 https://example.com/new-page/;

For path-based redirects, exact location blocks or carefully written rewrite directives may be appropriate. Nginx return directives are often preferable for simple redirects because their behavior is clear and requires less pattern processing.

After editing the configuration, validate it before reloading the service. A file can be syntactically valid yet still sit outside the included configuration tree, so inspect the loaded configuration when a rule appears to be ignored.

Apache and Nginx Checks

Apache:

  • Verify that the request reaches the expected virtual host.
  • Confirm mod_rewrite is enabled when using RewriteRule.
  • Check that .htaccess overrides are permitted.
  • Remove the leading slash from directory-context RewriteRule patterns.
  • Review earlier Redirect and RewriteRule directives.
  • Inspect Apache error and access logs.

Nginx:

  • Verify the active server_name and listen combination.
  • Confirm the edited file is included in the loaded configuration.
  • Test the syntax before reloading Nginx.
  • Look for an earlier return or rewrite directive.
  • Check whether a default server block receives the request.
  • Remember that .htaccess files are ignored.

WordPress Redirect Issues

WordPress redirects can come from plugins, theme code, core canonical redirects, hosting tools, or server configuration. A rule created in one location may conflict with another, especially after changing domains, enabling HTTPS, or installing a caching plugin.

Start by checking the WordPress Address and Site Address values. Both should reflect the intended protocol and hostname unless the installation intentionally separates the application directory from the public site URL.

Next, inspect redirect plugins for duplicate or wildcard rules. A broad expression can intercept admin pages, media files, or the intended destination. Temporarily disabling only the suspected redirect mechanism can help isolate the source, but take care on a live site.

Permalink changes can also affect routing. Refreshing permalink settings may regenerate rewrite rules, but it will not fix a hostname that points to the wrong server or a redirect cached at the CDN. Diagnose the response layer before repeatedly resaving settings.

Domain Redirects and DNS Confusion

DNS does not redirect web pages. It tells clients where a hostname should connect. To forward olddomain.com to newdomain.com, the old domain must resolve to a service that accepts the request and returns an HTTP redirect.

This distinction explains why changing an A record or CNAME does not change the browser’s visible URL. The visitor may simply see the new server’s content under the old hostname, encounter a certificate warning, or reach an unconfigured virtual host.

The old domain also needs a valid TLS certificate for HTTPS requests. The browser establishes a secure connection before it can receive the redirect. An expired or missing certificate can prevent the redirect response from being delivered at all.

Confirm domain registration, nameservers, DNS records, server routing, and TLS coverage separately. DNS changes may also take time to reach resolvers because previously cached records remain valid until their time-to-live values expire.

Domain Redirect Verification Steps

1. Confirm the old domain is registered and active.

2. Check that its authoritative nameservers are correct.

3. Verify the old hostname resolves to the intended redirect service.

4. Confirm both root and www hostnames are covered when needed.

5. Validate the TLS certificate for every HTTPS source hostname.

6. Request the old URL and inspect its HTTP status.

7. Confirm the Location header uses the final destination.

8. Test several old paths, not only the homepage.

9. Verify that query strings are handled as intended.

10. Keep the old domain and redirect hosting active for as long as valuable traffic or backlinks remain.

Query Strings, Parameters, and URL Encoding

Query strings can be preserved, removed, replaced, or used as matching conditions. The default behavior varies by server and directive. A redirect from /product?color=blue may accidentally drop the parameter or append it to a destination that already contains another query string.

Tracking parameters deserve special attention. You may want /old-page?utm_source=email to redirect to /new-page?utm_source=email, preserving campaign attribution. In other situations, obsolete application parameters should be removed to avoid duplicate URLs or broken destination pages.

Encoded characters can prevent matches. A space may appear as %20, and non-ASCII characters may use percent encoding. Servers and frameworks do not always perform matching at the same decoding stage.

Test realistic examples rather than a clean URL alone. Include marketing parameters, pagination, filters, mixed letter case, encoded characters, and empty values. Make the redirect intentionally preserve or discard parameters instead of relying on an assumed default.

HTTPS, Proxies, and Forwarded Headers

Reverse proxies and load balancers often handle the public HTTPS connection while communicating with the origin over HTTP. The application must use trusted forwarded headers to determine the visitor’s original protocol and hostname.

Common headers include X-Forwarded-Proto and Forwarded. If they are missing, ignored, or accepted from untrusted sources, redirects may be wrong or insecure. Configure trusted proxy addresses according to the framework and hosting platform rather than blindly trusting every forwarded header.

A proxy can also rewrite Location headers or cache redirects. That means the response seen at the origin may differ from the response delivered publicly. Compare an origin request, when safely possible, with the public request to identify where the change occurs.

Keep HTTPS enforcement in one clearly defined layer. Multiple layers can work, but they must agree about the canonical protocol, hostname, and port. Consistency prevents loops and avoids redirect chains.

Useful Query and Proxy Tests

  • Test the source URL with no query string.
  • Repeat the request with one ordinary parameter.
  • Test multiple parameters and encoded values.
  • Confirm whether tracking parameters reach the destination.
  • Compare the public response with the origin response.
  • Inspect X-Forwarded-Proto handling in the application.
  • Verify that the proxy sends the original hostname.
  • Check whether nonstandard ports appear in generated URLs.
  • Confirm the destination never downgrades HTTPS to HTTP.
  • Review CDN rules that modify request paths or response headers.

Redirect Chains and SEO Consequences

A redirect chain sends a request through two or more redirects before reaching the final page. Chains often grow over time as pages move repeatedly, domains change, or separate canonicalization rules are added.

Visitors experience extra network requests, particularly on slower mobile connections. Crawlers must also process each hop, and long or unstable chains make site maintenance harder. Redirect every known legacy URL directly to the current canonical destination whenever practical.

A redirect should lead to a genuinely relevant replacement. Sending every removed URL to the homepage may confuse visitors and can be treated as a soft 404 when the destination does not satisfy the original intent.

Update internal links, canonical tags, sitemaps, hreflang references, and navigation so they point directly to final URLs. Redirects are useful for external links and old bookmarks, but internal systems should not depend on avoidable hops. For broader cleanup, see [Internal Link: Technical SEO Audit Checklist].

Application and JavaScript Redirects

Framework routes, middleware, authentication systems, and controller logic can all generate redirects. Ordering matters because middleware may run before the route you intended to handle. An authentication redirect can therefore override a later path migration.

Environment differences are common. A redirect may work locally but fail in production because the base URL, proxy trust settings, route cache, or environment variables differ. Compare the actual production configuration rather than assuming it mirrors development.

JavaScript redirects run only after HTML and scripts load. They can fail because of script errors, content security policies, disabled JavaScript, or blocked resources. They also create a slower transition than an HTTP response.

Use a server-side redirect when the move applies to every visitor. Reserve client-side navigation for behavior that genuinely depends on information available in the browser, such as an in-app interaction. Avoid using JavaScript as a patch for a misconfigured server redirect.

Do and Don’t List for Reliable Redirects

Do:

  • Map each old URL to the most relevant current URL.
  • Use a direct server-side response where possible.
  • Test status codes and Location headers independently.
  • Preserve query strings only when they remain meaningful.
  • Update internal links to the final destination.
  • Keep a record of migration and redirect rules.
  • Monitor logs and 404 reports after deployment.

Don’t:

  • Redirect every missing page to the homepage.
  • Stack new rules on top of unexplained old rules.
  • assume DNS records perform HTTP redirects.
  • Use a permanent status while actively testing uncertain behavior.
  • Create rules that also match their own destinations.
  • Ignore HTTP, www, trailing-slash, and query-string variants.
  • Leave redirect chains in navigation, sitemaps, or canonical tags.

A Reliable Troubleshooting Process

Begin with one failing source URL and reproduce the problem outside your usual browser. Record the status code, Location header, and each hop. This establishes whether the issue is failure to match, an incorrect destination, a chain, or a loop.

Next, identify the first system capable of answering the request. Check DNS and TLS only as connection prerequisites, then inspect the CDN, reverse proxy, server, and application in that order. Stop when you find the layer returning the unexpected response.

Use this sequence:

1. Copy the exact failing URL.

2. Request headers without automatically following redirects.

3. Record the status and Location value.

4. Follow the chain and identify every hop.

5. Test source variants, including HTTP, HTTPS, www, slash, and parameters.

6. Locate the layer producing the first incorrect response.

7. Check its matching syntax, rule order, and active configuration.

8. Remove or revise conflicting rules.

9. Purge only the relevant caches.

10. Retest from a clean client.

11. Confirm the final URL returns 200.

12. Monitor server logs and crawl reports after deployment.

Change one meaningful variable at a time. Rewriting several server rules, clearing all caches, and changing WordPress settings simultaneously may appear to solve the problem, but it prevents you from learning which component was responsible.

Conclusion

When a redirect fails, the visible browser behavior rarely tells the whole story. The fastest diagnosis comes from checking the original HTTP response, reading the Location header, and tracing every hop to the final page. That evidence separates a rule that never matched from one that matched but produced the wrong destination.

If you are still wondering why is my redirect not working, compare the exact requested URL with the active rule, then inspect each layer in order: CDN, proxy, web server, application, and browser cache. Pay close attention to hostnames, HTTPS handling, trailing slashes, query strings, rule priority, and forwarded headers.

A reliable redirect should send the source directly to a relevant, working destination with the appropriate status code. The final page should return 200, and internal links should point there without using the redirect. Test realistic URL variations, remove loops and unnecessary chains, and document where each redirect is controlled. That approach resolves current failures while making future site changes safer and easier to maintain.

Frequently Asked Questions

Can a browser cache a broken redirect?

Yes. Browsers can cache permanent redirects, causing an old destination to appear after the server rule changes. Test with curl or a clean browser profile, then clear relevant browser, CDN, proxy, and server caches.

Why does my redirect work for HTTP but not HTTPS?

HTTPS requires a successful TLS connection before the server can return a redirect. Check the source hostname’s certificate, port 443 configuration, virtual host, CDN settings, and HTTPS-specific server block or routing rules.

Why does my redirect create too many redirects?

Two or more rules are sending the request in a circle. Trace every Location header and look for conflicting HTTPS, www, trailing-slash, proxy, WordPress, localization, or authentication rules that enforce opposite destinations.

Should I use a 301 or 302 redirect?

Use 301 for a genuinely permanent page or domain move. Use 302 for a temporary destination. For requests that must retain their HTTP method and body, consider 307 temporarily or 308 permanently.

Why does the homepage redirect work but inner pages fail?

The rule may forward only the root path instead of preserving or mapping deeper paths. Check wildcard matching, path capture groups, destination substitutions, server routing, and whether inner URLs reach a different application handler.

Submit a Comment

Your email address will not be published. Required fields are marked *