Page 1 of 1

Redirecting to same page

Posted: Fri Nov 29, 2002 11:29 am
by abdul
Hi..

I am trying to redirect to the same page with an additional querystring from an include file. Here is the code

Code: Select all

$location = "template1.php?pageid=". $_GETї"pageid"]. "&errnum=1";
header ("Location:". $location);
which is working fine. But, if I replace "template1.php" with $_SERVER["PHP_SELF"], it is just hanging on the same page until the script is timed out.

Code: Select all

$location = $_SERVERї"PHP_SELF"]."?pageid=". $_GETї"pageid"]. "&errnum=1";
header ("Location:".$location);
Looks like it is getting into an infinite loop. In that case, I would expect the first code also to fail, if I run the code from "template1.php". But, it is not. Any ideas..?

Posted: Fri Nov 29, 2002 11:38 am
by hedge
is it on IIS, we have had a similar problem. It seems we can't use relative url's or it hangs but if you give a full url it works fine...

weird.

Posted: Fri Nov 29, 2002 12:34 pm
by abdul
Yes, it is on IIS. So, you mean it may work on apache. Okay, let me give it a try.

Thanks,

-Abdul

Posted: Fri Nov 29, 2002 3:08 pm
by abdul
Thanks, It is working perfectly on apache. There seems to a lot of differences between PHP on IIS and on apache. Is there any article, which consolidates all of these. Because my development server is running IIS and deployment server is running apache. So, I am wasting a lot of time tracing the root of these kind of silly bugs. Is it worth installing apache on windows..? Will it clash with IIS (I need IIS aswell as many of our sites are developed in ASP).

Thanks,

-Abdul