For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > November 2005 > Re: displaying a different page after a header("Location:$newurl") time ou









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: displaying a different page after a header("Location:$newurl") time ou
Connector5

2005-11-17, 3:55 am

Building on Philip's response:

I use a 3-stage approach to do this:


1) Make a link_outgoing.php page to serve up redirects (if you arent using
one already). This has the nice side effect of enabling click-counting (see
http://libertyreturns.com, http://linkswarm.com, or http://zfilter.com for
examples).

2) Set up a cron job (*nix) and use cURL to check site links every X amount
of minutes (I use 30). It tries to find the link up to 3 times per search.
If the link is not found after 60 minutes, it is flagged as unavailable and
I get an email.

3) Use Philip's method 2 from inside your link_outgoing.php page (or
whatever you are using). If the page is unavailable according to fopen,
dont refuse your site visitors the chance to try it theirselves. Instead,
present a page informing them that you cant confirm the link is available,
but "Click here to try for yourself". etc etc.






"Philip Ronan" <invalid@invalid.invalid> wrote in message
news:BFA142A3.3AF8B%invalid@invalid.invalid...
> "Peter" wrote:
>
page[color=darkred]
detect[color=darkred]
or[color=darkred]
>
> No. Once the client's browser has been redirected from your site, it won't
> come back until the user tells it to.
>
> Your two options are:
>
> 1) Periodically check your outgoing links to make sure they are still
> valid.
>
> 2) Before sending out the "Location" header, use @fopen("$newurl") to
> check that the URL is actually accessible. If not, do something else.
>
> Option 2 isn't foolproof, because if there's a lot of traffic on the
> network, a site that your server can't reach may still be accessible to

the
> user. And obviously it slows things up and generates extra traffic.
>
> --
> phil [dot] ronan @ virgin [dot] net
> http://vzone.virgin.net/phil.ronan/
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com