|
Sometimes
it is necessary to redirect the viewer automatically to another page.
This can be achieved in several ways.
None are perfect for every instance and the most important issue to bear
in mind is that if your get the server to drive it - the client browser
has nothing to do with it - but its use is limited to action prior to
anything at all delivered to the browser. The other methods rely entirely
upon the browser, and that means the client may interfere with your intended
action.
- PHP header redirect - BUT there must be NO output to browser before
this command
- Javascript - but viewer MUST have Javascript turned on
- Meta tag in header - but viewer can override this (if they know what they are doing
To deal with each in turn:
- PHP header redirect
Go here to PHP
manual
$host = $_SERVER['HTTP_HOST'];
$dir = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
$sess = session_id();
$file2go2 = "redirect.php?sess=$sess";
header("Location: http://$host$dir/$file2go2");
The code "http://$host$dir/$file2go2" is displayed below here
- exactly as written
http://www.itsveryeasy.com/redirect.php?sess=f4ec97279d566a5317342242d24f4993
|