Jump to content

Header Location with Query String


unemployment

Recommended Posts

What are the contents of $_SERVER['PHP_SELF'] and $_SERVER['QUERY_STRING'] ?

 

PHP SELF is blog.php

 

QUERY STRING is  ?post_id=18

 

Together they make blog.php?post_id=18

 

and yes the above does not work for me.  It just redirects me to blog.php

That's strange.. you can try this:

 

$redirect = $_SERVER['PHP_SELF'] . $_SERVER['QUERY_STRING'];
print "Would redirect to $redirect if we weren't exiting now"; exit;
header("Location: $redirect");

 

Once you've confirmed that $redirect is correct you can remove the "exit;".  If $redirect really is the right url then I don't see why it wouldn't work

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.