Redirecting to same page

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
abdul
Forum Newbie
Posts: 24
Joined: Thu Nov 14, 2002 7:35 am

Redirecting to same page

Post 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..?
hedge
Forum Contributor
Posts: 234
Joined: Fri Aug 30, 2002 10:19 am
Location: Calgary, AB, Canada

Post 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.
abdul
Forum Newbie
Posts: 24
Joined: Thu Nov 14, 2002 7:35 am

Post by abdul »

Yes, it is on IIS. So, you mean it may work on apache. Okay, let me give it a try.

Thanks,

-Abdul
abdul
Forum Newbie
Posts: 24
Joined: Thu Nov 14, 2002 7:35 am

Post 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
Post Reply