Re: Redirecting from unreachable page on website

From: Date: Wed, 21 Jan 2009 20:50:30 +0000
Subject: Re: Redirecting from unreachable page on website
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-286950@lists.php.net to get a copy of this message
Per Jessen schreef: > Dušan Novaković wrote: > >> Hi, >> >> Is there some elegant solution how to redirect if someone try to open >> some non existing page (e.g www.domain.com/nonexistingpage.php) to >> main page www.domain.com on website? >> > > See Apache "ErrorDocument" directive. > ai, ErrorDocument 404 /404.php <?php // 404.php // do something with query args? // or just redirect header('Location: /'); // there should really be FQDN there, but I never bother. ?> or just have apache do all of it ... having a php script handle the 404 allows you to do fun things with requested URI, GET string, etc > > /Per Jessen, Zürich > >

« previous php.general (#286950) next »