Re: How to make sure a redirect works
| From: | Burhan Khalid | Date: | Wed, 10 Mar 2004 13:49:38 +0000 |
| Subject: | Re: How to make sure a redirect works | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-180017@lists.php.net to get a copy of this message | ||
Henry Grech-Cini wrote:
Hi All, I want to randomly select a desitniation page and use cookies to ensure that refreshes and return visits on the same machine always return to that desination (assuming the cookie is intact). Imagine that we have an array of URL's $url=array(1=>"dest1.html", "dest2.html", "dest3.html"); // I'm using the 1=> so that I don't need to store 0 in a cookie! and that we have a variable $index which has a value in it (either set to a cookie value, if this is a refresh or return visit, or a random value [1-3] if this is the first visit My question is are there problems with: <?php header("Location: ".$url[$index]); ?> Might some browsers fail to redirect to the required destination? If so under what circumstances?In this example, it will not work because Location: expects the target to be a fully qualified URL. Other than that, I don't see why it wouldn't work.