I have a link from one of my pages to another, been working fine even this morning, then i clicked it again (did not change anything on the page that contains the link.) then suddenly it says "page isn't redirecting properly. server is redirecting in a way that will never complete". dont understand..was fine 1 min and not the next.. any thoughts?

Dani AI

Generated

's diagnosis (an unintended redirect loop) is the typical cause of the Firefox message. A server that keeps returning 3xx responses (or code that keeps forcing a redirect based on a condition that never changes) will make the browser stop with that error. A few focused checks and small safeguards prevent or reveal these loops quickly.

Common practical checks:

  • Inspect the redirect chain in the browser Network panel (enable "Preserve log") to see each 3xx and its target.
  • Reproduce from the command line (example: curl -I -L -v http://localhost/path) to see headers and where the chain lands.
  • Clear cookies/session data to rule out auth/session-driven loops.
  • Review .htaccess / mod_rewrite or virtual host rules for mutual redirects (www ↔ non-www, http ↔ https).
  • Look for missing exit/die after PHP header('Location: ...') calls or logic that always evaluates true and sends the redirect again.
  • Check WAMP Apache access/error logs (logs folder in the WAMP install) for rapid repeated requests or chain details.

Safe PHP patterns (Post/Redirect/Get and loop guard):

<?php
session_start();

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    // validation...
    if ($valid) {
        header('HTTP/1.1 303 See Other');
        header('Location: /success.php');
        exit;
    }
}

// simple loop guard if a redirect might re-enter the same script
if (empty($_SESSION['redirect_once'])) {
    $_SESSION['redirect_once'] = 1;
    header('Location: /form.php');
    exit;
}
unset($_SESSION['redirect_once']);
?>

Notes: prefer 303 after a POST to avoid resubmission, always exit after sending a Location header, and keep redirect targets stable (avoid redirecting to the same URL or to another rule that redirects back). These steps make it easier to find the offending redirect and prevent accidental loops.

Nevermind.. I had a header redirect in the form validation for error handeling, i accidentially created an infinite redirect loop. Sorry.. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.