This webpage has a redirect loop

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ditditsasa
    New Member
    • Mar 2012
    • 17

    This webpage has a redirect loop

    in my php page have the following error

    The webpage at http://localhost/emr4all/multiclient/index.php has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer.

    Code:
    <code>$filename=$GLOBALS['OE_SITE_DIR'];
    if (file_exists($filename)) {
        require_once($GLOBALS['OE_SITE_DIR'] . "/config.php");
    } else {
    
           //$_SESSION['multi'] = 1;
           header("Location:/../emr4all/multiclient/index.php");
      }</code>
    the header cant redirect pls help me
    Last edited by Rabbit; Apr 11 '12, 04:15 PM. Reason: Please use code tags when posting code.
  • Marknut
    New Member
    • Apr 2010
    • 42

    #2
    Try adding exit after the header.

    Code:
    $filename=$GLOBALS['OE_SITE_DIR'];
    if (file_exists($filename)) {
    require_once($GLOBALS['OE_SITE_DIR'] . "/config.php");
    } else {
    
    //$_SESSION['multi'] = 1;
    header("Location:/../emr4all/multiclient/index.php");
    [B]exit;[/B]
    }

    Comment

    • Rabbit
      Recognized Expert MVP
      • Jan 2007
      • 12517

      #3
      Are you redirecting the page to itself? Why would you do that?

      Comment

      • ditditsasa
        New Member
        • Mar 2012
        • 17

        #4
        because login failure can redirect the login page

        Comment

        • johny10151981
          Top Contributor
          • Jan 2010
          • 1059

          #5
          why dont you do the other way? if fail load the page without redirecting if succeed redirect to the desired page

          The reason I am saying this is because: you will validate in this page, if fail you will give the log in window from the same page, if succeed you will redirect to different page.

          but if this is like this that log in failed and you are reloading the same page without the uri, which would lead it to log in page, is really unnecessary

          Comment

          Working...