Check URL --> Simply?

Garth Grimm garth_grimm at hp.com
Thu Aug 16 13:51:19 EDT 2001


"David Eppstein" <eppstein at ics.uci.edu> wrote in message
news:eppstein-4134A3.10064016082001 at news.service.uci.edu...
> In article <mailman.997979553.20974.python-list at python.org>,
>  "Dr. David Mertz" <mertz at gnosis.cx> wrote:
>
> >     % python check_url.py
> >     http://msnbc.com/nonsense (200, 'OK')
> >     http://msnbc.com/ (302, 'Object moved')
> >     http://w3c.org/ (301, 'Moved Permanently')
> >     http://w3c.org/nonsense (301, 'Moved Permanently')
> >     http://w3c.org/Consortium/ (301, 'Moved Permanently')
> >     http://ibm.com/ (200, 'OK')
> >     http://ibm.com/nonsense (404, 'Not Found')
> >
> > I tried a few sites to get these examples... but not all *that* many.
> > All the sites that end in 'nonsense' LOOK, to my human eyes, like broken
> > links... and all the others look like content (well, except msnbc.com,
> > which refuses to load--I think because I won't give it a cookie--and
> > wouldn't actually be other than nonsense if it would load :-)).
>
> I don't know about the msnbc examples, but the 301 from w3c is telling you
> something useful -- it prefers to be called www.w3.org.

Yes, but to a typical user, that is called a dead link.  From the server
side, the most user friendly way to handle this is to return a 404 (or
perhaps a 301) code and message, but then use a web page with a refresh of 0
to send the user to the home page.

----
Garth





More information about the Python-list mailing list