By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,985 Members | 1,861 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,985 IT Pros & Developers. It's quick & easy.

This webpage has a redirect loop

ditditsasa
P: 17
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.

Expand|Select|Wrap|Line Numbers
  1. <code>$filename=$GLOBALS['OE_SITE_DIR'];
  2. if (file_exists($filename)) {
  3.     require_once($GLOBALS['OE_SITE_DIR'] . "/config.php");
  4. } else {
  5.  
  6.        //$_SESSION['multi'] = 1;
  7.        header("Location:/../emr4all/multiclient/index.php");
  8.   }</code>
the header cant redirect pls help me
Apr 11 '12 #1
Share this Question
Share on Google+
4 Replies


P: 42
Try adding exit after the header.

Expand|Select|Wrap|Line Numbers
  1. $filename=$GLOBALS['OE_SITE_DIR'];
  2. if (file_exists($filename)) {
  3. require_once($GLOBALS['OE_SITE_DIR'] . "/config.php");
  4. } else {
  5.  
  6. //$_SESSION['multi'] = 1;
  7. header("Location:/../emr4all/multiclient/index.php");
  8. exit;
  9. }
Apr 11 '12 #2

Rabbit
Expert Mod 10K+
P: 12,349
Are you redirecting the page to itself? Why would you do that?
Apr 11 '12 #3

ditditsasa
P: 17
because login failure can redirect the login page
Apr 12 '12 #4

100+
P: 1,059
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
Apr 12 '12 #5

Post your reply

Sign in to post your reply or Sign up for a free account.