|
-
Sep 26th, 2002, 10:34 AM
#1
Thread Starter
Addicted Member
PHP Redirect
I wanted to confirm something.
Let's say that http://www.foo.com/index.php checks for a "Have you been here before cookie" and then redirects you to http://www.foo.com/foo/index.html. Is this correct, and if so, what does it do? Does it just simulate a meta tag, or do a server side switch?
Code:
<?php
header("Location: /foo/index.html");
?>
Travis, Kung Foo Journeyman
Web Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.5 Guide and Reference
Perl: Documentation, Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
OSS: Mozilla, MySQL (Manual)
-
Sep 26th, 2002, 10:35 PM
#2
Stuck in the 80s
That's wrong. It has to be the full URL like you would type in the Address box.
It just simply tells the browser where to go and what page to load.
-
Sep 27th, 2002, 08:51 AM
#3
Fanatic Member
Originally posted by The Hobo
That's wrong. It has to be the full URL like you would type in the Address box.
It just simply tells the browser where to go and what page to load.
I have never had to use an absolute URL in the header("Location:") function. I normally just write index.html or something and it works great.
-
Sep 27th, 2002, 09:08 AM
#4
Thread Starter
Addicted Member
I thought the documentation said the local address would work, but if it doesn't, I'll qualify it.
But judging by Hobo's answer, the header function is sending a meta tag to the browser?
If so, then I may just avoid using it. We'll see.
Travis, Kung Foo Journeyman
Web Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.5 Guide and Reference
Perl: Documentation, Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
OSS: Mozilla, MySQL (Manual)
-
Sep 27th, 2002, 12:55 PM
#5
Stuck in the 80s
cpradio - Guess I should get my facts straight before I post, eh?
Travis G - Why does it matter how it works? It sends the browser to the designated location.
-
Sep 27th, 2002, 01:31 PM
#6
Fanatic Member
I use the php version after a form was submitted so they cannot hit refresh and have all the data resent.
-
Sep 27th, 2002, 01:32 PM
#7
Frenzied Member
the header doesn't send a meta tag to the browser. close but no cigar. try putting the header tag anywhere in your document and I bet you get errors, with the meta tag you don't get any errors.
-
Oct 1st, 2002, 02:16 PM
#8
Frenzied Member
Originally posted by The Hobo
That's wrong. It has to be the full URL like you would type in the Address box.
It just simply tells the browser where to go and what page to load.
it doesnt have to be absolute,
u can use all terms you can in the meta refresh,
Its just like sending the page header's, like "Content : text/html"
And then the browser goes to the new page 
--
And most cases EVEN IF the person has disabled the IE meta refresh options
-
Oct 1st, 2002, 02:27 PM
#9
Stuck in the 80s
Originally posted by wpearsall
it doesnt have to be absolute,
u can use all terms you can in the meta refresh,
Its just like sending the page header's, like "Content : text/html"
And then the browser goes to the new page 
--
And most cases EVEN IF the person has disabled the IE meta refresh options
Yes. We've already discovered that I'm wrong. But thanks for ringing in a few days late.
-
Oct 1st, 2002, 04:33 PM
#10
Thread Starter
Addicted Member
Why does it matter how it works? It sends the browser to the designated location.
I just don't want the delay of two transactions, everytime someone loads the page.
I wrote my site, and realized that I was using CSS 2, something that IE simply doesn't support. So I wanted to make a reduced version of my site for people with inferior browsers. I figured, once they visit the reduced site, a cookie will be set. Every time they visit, it will look for the cookie and direct them to the version they browsed last.
I just don't want to delay everyone who is visiting. I just figure I'll have PHP pull in the page and show it to them, without redirecting.
Thanks for the help though.
Travis, Kung Foo Journeyman
Web Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.5 Guide and Reference
Perl: Documentation, Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
OSS: Mozilla, MySQL (Manual)
-
Oct 1st, 2002, 05:00 PM
#11
Stuck in the 80s
Originally posted by Travis G
I just don't want the delay of two transactions, everytime someone loads the page.
I wrote my site, and realized that I was using CSS 2, something that IE simply doesn't support. So I wanted to make a reduced version of my site for people with inferior browsers. I figured, once they visit the reduced site, a cookie will be set. Every time they visit, it will look for the cookie and direct them to the version they browsed last.
I just don't want to delay everyone who is visiting. I just figure I'll have PHP pull in the page and show it to them, without redirecting.
Thanks for the help though.
The header() function would work great for this scenario. I don't see why you think it wont?
-
Oct 2nd, 2002, 04:39 AM
#12
Frenzied Member
Huh huh,
IT bearly takes any time to use the header function
its less then a split second,,
B4 you relize you are at a new page, its happened...
I.Explorer DOESNT EVEN RELIZE ITS BEING REDIRECTED IT HAPPENS SO FAST.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|