[Web-Development] Re: PHP: META HTTP-EQUIV="[REFRESH,
REDIRCT"] Firefox .vs. Internet Explorer
chuck
[Address Concealed]
Wed Jun 6 13:03:07 EDT 2007
Chuck, if you'll help me understand more specifically what you want to do
and why, I might have some suggestions.
The "once per session" part can be done easily in a single PHP page.
Something like this:
<?php
session_start();
if (!isset($_SESSION['beenthere']) {
$_SESSION['beenthere'] = true;
// The following will be done once per session.
...
}
?>
<html>
...
>/ I am using the <meta http-equiv="REFRESH"
/>/ content="0;url=http://www.the-domain-you-want-to-redirect-to.com" <http://www.the-domain-you-want-to-redirect-to.com%22>>
/>/ now. However I see a warning about this breaking the 'back' button. I
/>/ think I know why some web sites won't let me leave by suing the 'back'
/>/ button. :-|
/
You can also look at using the Location response header to do the
redirect -- it's a little cleaner than the meta refresh, as you won't see the
first page "flash" before the redirect. Just be sure to use an absolute
URL, to meet the HTTP spec:
<?php
header("Location: http://www.example.com/mypage.html" <http://www.example.com/mypage.html%22>);
exit;
?>
or
<?php
/* Redirect to a different page in the current directory */
$host = $_SERVER['HTTP_HOST'];
$uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
$extra = 'mypage.html';
header("Location: http://$host$uri/$extra" <http://$host$uri/$extra%22>);
exit;
?>
--
Grant Root
Hi, Grant:
Thanks. I want to obtain information on folks that visit my web site,
expressly to determine that the visitors are humans
(as opposed to spiders/robots/crawlers/...). I found out that the 'host'
command is available with Linux web servers, but not Windows based servers
(My readyhosting.com web hosted web servers are Windows based).
I am now redirecting visitors from my hosted account's default
to my home based linux apache server, running a small .php script,
the returning the visitors to my.hosted.account.com/main/index.htm.
I especially like your sample script to determine if a session is current
and to not execute a portion of a script
-and-
your sample to redirect with 'flashing' the redirection to the visitor.
;-)
I've only time for this response now. I'll delve deeper this PM.
l8r, Chuck
More information about the Web-Development
mailing list