RE: [PHP] redirecting to a url..
| From: | Ow Mun Heng | Date: | Mon, 21 Jul 2003 02:40:29 +0000 |
| Subject: | RE: [PHP] redirecting to a url.. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-156008@lists.php.net to get a copy of this message | ||
Me,
I have 2 functions. 1 I call - immediate and other refresh.. the
difference is one as the name implies is immediate - (like chris pointed out
below ) ->
header('Location: http://yoursite.org/us/index.php');
The other is more of a refresh kind, waits a default of 2 secs (for me so
that I can show a warning message before it redirects..
function header_refresh_html($l_refresh_url)
{
// This is taken from php-manual
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
// Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); //
always modified
header("Cache-Control: no-store, no-cache, must-revalidate"); //
HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
// HTTP/1.0
header( "Refresh:2;url=$l_refresh_url" ); // Wait
default of 2 seconds
}
Cheers,
Mun Heng, Ow
H/M Engineering
Western Digital M'sia
DID : 03-7870 5168
-----Original Message-----
From: Chris Shiflett [mailto:shiflett@php.net]
Sent: Friday, July 18, 2003 11:46 PM
To: Louie Miranda; php-general@lists.php.net
Subject: Re: [PHP] redirecting to a url..
--- Louie Miranda <louie@axishift.ath.cx> wrote:
> echo "<meta http-equiv=\"REFRESH\" CONTENT=\"0;
> URL=us/index.php\">";
>
> Or you may have other more advance alternatives?
You can use a protocol redirect rather than relying on HTML:
header('Location: http://yoursite.org/us/index.php');
Chris
=====
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/