Re: [PHP] Redirects in PHP
On Fri, 13 Jun 2003 12:22:44 -0400, Carl Furst wrote: How do you do this? Use JavaScript. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Redirects in PHP
try a delayed javascript redirect. location header must be in the header whichprevents your visitor from seeing html...thats irritating. i miss the ASP response.redirect which can be placed anywhere J -Original Message- From: Carl Furst [mailto:[EMAIL PROTECTED] Sent: Friday, June 13, 2003 9:23 AM To: Subject: [PHP] Redirects in PHP I want to do one of those redirect pages where a php script prints HTML saying sorry we're not here, we're redirecting you to the right location and then after about 2-3 seconds a new location header gets printed and you are transported to the new location. I see this everywhere but don't know how it's done. I tried this by printing the Location header first and then the text and it just relocated me without seeing the text. I tried printing the text first and then the Location header and php complains that my header was already sent and I can't modify it to relocate. How do you do this?? Is there something in the header I have to specify to wait before it relocates? Do I have to do it manually by printing the text.. tell the script to wait and then clear the header somehow and send a new one (can that be done?) I looked at HTTP1.1 docs and I didn't really get anywhere. Any ideas? Carl. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Redirects in PHP
Build a JavaScript and have it execute as the document loads... i.e. in the body tag with an onLoad event... the header function in php will not do anything if you have sent output already -Original Message- From: Carl Furst [mailto:[EMAIL PROTECTED] Sent: June 13, 2003 9:23 AM To: [EMAIL PROTECTED] Subject: [PHP] Redirects in PHP I want to do one of those redirect pages where a php script prints HTML saying sorry we're not here, we're redirecting you to the right location and then after about 2-3 seconds a new location header gets printed and you are transported to the new location. I see this everywhere but don't know how it's done. I tried this by printing the Location header first and then the text and it just relocated me without seeing the text. I tried printing the text first and then the Location header and php complains that my header was already sent and I can't modify it to relocate. How do you do this?? Is there something in the header I have to specify to wait before it relocates? Do I have to do it manually by printing the text.. tell the script to wait and then clear the header somehow and send a new one (can that be done?) I looked at HTTP1.1 docs and I didn't really get anywhere. Any ideas? Carl. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirects in PHP
I miss the response.redirect in Python and DTML which can be placed anywhere as well. Michael On Friday 13 June 2003 10:28 am, Johnny Martinez wrote: try a delayed javascript redirect. location header must be in the header whichprevents your visitor from seeing html...thats irritating. i miss the ASP response.redirect which can be placed anywhere J -Original Message- From: Carl Furst [mailto:[EMAIL PROTECTED] Sent: Friday, June 13, 2003 9:23 AM To: Subject: [PHP] Redirects in PHP I want to do one of those redirect pages where a php script prints HTML saying sorry we're not here, we're redirecting you to the right location and then after about 2-3 seconds a new location header gets printed and you are transported to the new location. I see this everywhere but don't know how it's done. I tried this by printing the Location header first and then the text and it just relocated me without seeing the text. I tried printing the text first and then the Location header and php complains that my header was already sent and I can't modify it to relocate. How do you do this?? Is there something in the header I have to specify to wait before it relocates? Do I have to do it manually by printing the text.. tell the script to wait and then clear the header somehow and send a new one (can that be done?) I looked at HTTP1.1 docs and I didn't really get anywhere. Any ideas? Carl. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirects in PHP
Javascript.. bah humbug. :) Carl, you can avoid these issues by using output buffering allowing you to call header() whever you want in your script. ? // example.. ob_start(); // buffer output echo this is output you'll never see; header(Location: thankyou.html); // header redirect ob_end_flush(); // flush output ? - Kevin - Original Message - From: Johnny Martinez [EMAIL PROTECTED] To: 'Carl Furst' [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Friday, June 13, 2003 10:28 AM Subject: RE: [PHP] Redirects in PHP try a delayed javascript redirect. location header must be in the header whichprevents your visitor from seeing html...thats irritating. i miss the ASP response.redirect which can be placed anywhere J -Original Message- From: Carl Furst [mailto:[EMAIL PROTECTED] Sent: Friday, June 13, 2003 9:23 AM To: Subject: [PHP] Redirects in PHP I want to do one of those redirect pages where a php script prints HTML saying sorry we're not here, we're redirecting you to the right location and then after about 2-3 seconds a new location header gets printed and you are transported to the new location. I see this everywhere but don't know how it's done. I tried this by printing the Location header first and then the text and it just relocated me without seeing the text. I tried printing the text first and then the Location header and php complains that my header was already sent and I can't modify it to relocate. How do you do this?? Is there something in the header I have to specify to wait before it relocates? Do I have to do it manually by printing the text.. tell the script to wait and then clear the header somehow and send a new one (can that be done?) I looked at HTTP1.1 docs and I didn't really get anywhere. Any ideas? Carl. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirects in PHP
On 2003-06-13 10:54-0600, Kevin Stone wrote: Carl, you can avoid these issues by using output buffering allowing you to call header() whever you want in your script. This will not solve the OP's problem; the header will still be output first, and the client will be immediately redirected. I am curious though; why is everyone suggesting to use JavaScript when the following in the head section of the HTML document will work just as well? meta http-equiv=refresh content=3;URL=http://example.com/new-page.html; / Am I missing something? -Zak -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirects in PHP
On Fri, 13 Jun 2003 10:54:39 -0600, Kevin Stone wrote: Javascript.. bah humbug. :) Carl, you can avoid these issues by using output buffering allowing you to call header() whever you want in your script. But he doesn't get to see the printed info - so it's basically the same difference. I think either JavaScipt is probably the solution I have also found reference to the following: meta http-equiv=Refresh content=8;URL=http:// www.example.com/somepage.html It is supposed to do what is wanted but it's not W3C standard. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirects in PHP
- Original Message - From: Zak Johnson [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, June 13, 2003 11:00 AM Subject: Re: [PHP] Redirects in PHP On 2003-06-13 10:54-0600, Kevin Stone wrote: Carl, you can avoid these issues by using output buffering allowing you to call header() whever you want in your script. This will not solve the OP's problem; the header will still be output first, and the client will be immediately redirected. I am curious though; why is everyone suggesting to use JavaScript when the following in the head section of the HTML document will work just as well? meta http-equiv=refresh content=3;URL=http://example.com/new-page.html; / Am I missing something? -Zak Oh you're right I didn't read the original post. You can still use the OB method and redirect to an HTML page containing the sorry we're not here, we're redirecting you to the right location message and meta refresh without goofing up the output in the original script. It's a straight forward and clean transition. - Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirects in PHP
Search engines frown on using meta refresh because of abuse problems. Some engines won't index the page period and all of them penalize you at the very least. While it will work as you described, you're sacrificing search engine positioning to use it. You need to weigh the trade-offs Michael On Friday 13 June 2003 11:00 am, Zak Johnson wrote: meta http-equiv=refresh content=3;URL=http://example.com/new-page.html; / -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirects in PHP
On 2003-06-13 10:34-0600, Michael wrote: Search engines frown on using meta refresh because of abuse problems. Some engines won't index the page period and all of them penalize you at the very least. While it will work as you described, you're sacrificing search engine positioning to use it. How many search engines do you know of that will parse and follow the JavaScript location.href redirection suggested earlier? -Zak -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirects in PHP
You're absolutely right. Thus, the need for a server-side redirect. You can use meta refresh as long as the time is set to around 10 seconds without being penalized. I guess you could include a message that you are going to be transferred in 10 seconds, then provide a link for the impatient types, like myself, to get there quicker. michael On Friday 13 June 2003 11:30 am, Zak Johnson wrote: On 2003-06-13 10:34-0600, Michael wrote: Search engines frown on using meta refresh because of abuse problems. Some engines won't index the page period and all of them penalize you at the very least. While it will work as you described, you're sacrificing search engine positioning to use it. How many search engines do you know of that will parse and follow the JavaScript location.href redirection suggested earlier? -Zak -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Redirects in PHP
I don't know of any, but is there a good alternative? -Original Message- From: Zak Johnson [mailto:[EMAIL PROTECTED] Sent: Friday, June 13, 2003 1:31 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Redirects in PHP On 2003-06-13 10:34-0600, Michael wrote: Search engines frown on using meta refresh because of abuse problems. Some engines won't index the page period and all of them penalize you at the very least. While it will work as you described, you're sacrificing search engine positioning to use it. How many search engines do you know of that will parse and follow the JavaScript location.href redirection suggested earlier? -Zak -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Redirects in PHP
I can understand the abuse, but this page wouldn't need to be indexed on any search engines really.. but I it's an important consideration. Thanks! Thanks to everyone! Carl. -Original Message- From: Michael [mailto:[EMAIL PROTECTED] Sent: Friday, June 13, 2003 12:35 PM To: Zak Johnson; [EMAIL PROTECTED] Subject: Re: [PHP] Redirects in PHP Search engines frown on using meta refresh because of abuse problems. Some engines won't index the page period and all of them penalize you at the very least. While it will work as you described, you're sacrificing search engine positioning to use it. You need to weigh the trade-offs Michael On Friday 13 June 2003 11:00 am, Zak Johnson wrote: meta http-equiv=refresh content=3;URL=http://example.com/new-page.html; / -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Redirects in PHP
You can do the cheesy: This page has moved. Please click this link. heheh J -Original Message- From: Carl Furst [mailto:[EMAIL PROTECTED] Sent: Friday, June 13, 2003 10:43 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: RE: [PHP] Redirects in PHP I can understand the abuse, but this page wouldn't need to be indexed on any search engines really.. but I it's an important consideration. Thanks! Thanks to everyone! Carl. -Original Message- From: Michael [mailto:[EMAIL PROTECTED] Sent: Friday, June 13, 2003 12:35 PM To: Zak Johnson; [EMAIL PROTECTED] Subject: Re: [PHP] Redirects in PHP Search engines frown on using meta refresh because of abuse problems. Some engines won't index the page period and all of them penalize you at the very least. While it will work as you described, you're sacrificing search engine positioning to use it. You need to weigh the trade-offs Michael On Friday 13 June 2003 11:00 am, Zak Johnson wrote: meta http-equiv=refresh content=3;URL=http://example.com/new-page.html; / -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirects in PHP
At 19:00 13.06.2003, Zak Johnson said: [snip] This will not solve the OP's problem; the header will still be output first, and the client will be immediately redirected. I am curious though; why is everyone suggesting to use JavaScript when the following in the head section of the HTML document will work just as well? meta http-equiv=refresh content=3;URL=http://example.com/new-page.html; / Am I missing something? [snip] This will (or should...) always work regardless of JS settings. Being a HTTP equivalent this also means you can transmit it as MIME header as well: header('Refresh: 5;URL=http://www.microsoft.com;'); echo 'Transferring you to Microsoft in 5 seconds...'; exit; HTH, -- O Ernest E. Vogelsinger (\)ICQ #13394035 ^ http://www.vogelsinger.at/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Redirects in PHP
But is this the type of stuff that gets penalized in Search Engines or no? -Original Message- From: Ernest E Vogelsinger [mailto:[EMAIL PROTECTED] Sent: Friday, June 13, 2003 1:47 PM To: Zak Johnson Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Redirects in PHP At 19:00 13.06.2003, Zak Johnson said: [snip] This will not solve the OP's problem; the header will still be output first, and the client will be immediately redirected. I am curious though; why is everyone suggesting to use JavaScript when the following in the head section of the HTML document will work just as well? meta http-equiv=refresh content=3;URL=http://example.com/new-page.html; / Am I missing something? [snip] This will (or should...) always work regardless of JS settings. Being a HTTP equivalent this also means you can transmit it as MIME header as well: header('Refresh: 5;URL=http://www.microsoft.com;'); echo 'Transferring you to Microsoft in 5 seconds...'; exit; HTH, -- O Ernest E. Vogelsinger (\)ICQ #13394035 ^ http://www.vogelsinger.at/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php