From owner-freebsd-questions@FreeBSD.ORG Sun Oct 3 12:09:56 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7A23616A4CE for ; Sun, 3 Oct 2004 12:09:56 +0000 (GMT) Received: from mail.devrandom.org.uk (mail.devrandom.org.uk [84.92.10.242]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8FC8143D2D for ; Sun, 3 Oct 2004 12:09:55 +0000 (GMT) (envelope-from howells@kde.org) Received: from localhost (frodo [192.168.1.8]) by mail.devrandom.org.uk (Postfix) with ESMTP id 2E7FCAF20; Sun, 3 Oct 2004 14:11:57 +0100 (BST) Received: from mail.devrandom.org.uk ([192.168.1.8]) by localhost (frodo [192.168.1.8]) (amavisd-new, port 10024) with ESMTP id 27389-10; Sun, 3 Oct 2004 14:11:56 +0100 (BST) Received: from [192.168.1.176] (unknown [192.168.1.176]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by mail.devrandom.org.uk (Postfix) with ESMTP id 35D0EAF28; Sun, 3 Oct 2004 14:11:56 +0100 (BST) From: Chris Howells Organization: K Desktop Environment To: freebsd-questions@freebsd.org Date: Sun, 3 Oct 2004 13:09:48 +0100 User-Agent: KMail/1.7.50 References: <20041002231007.GA80368@skytrackercanada.com> In-Reply-To: <20041002231007.GA80368@skytrackercanada.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart3406812.K86LBuWXrz"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <200410031309.52491.howells@kde.org> X-Virus-Scanned: by amavisd-new at devrandom.org.uk cc: David Banning Subject: Re: apache - how to redirect page not found X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2004 12:09:56 -0000 --nextPart3406812.K86LBuWXrz Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Sunday 03 October 2004 00:10, David Banning wrote: > I notice on some web sites when you try to load a page that does not > exist, it directs the users browser to another page. How do I set > that up in apache? If you have PHP installed, you can use the following PHP code: Of course this has the beauty that you can set up a PHP script as a 404=20 handler, and if you know the old location of a page, then it is very trivia= l=20 to automatically re-direct to this new location (since you know the path th= at=20 was requested). We use something like this on the KDE web site: http://webcvs.kde.org/cgi-bin/cvsweb.cgi/www/media/includes/classes/class_h= andler404.inc?rev=3D1.4 e.g. add("/anoncvs.html","http://developer.kde.org/source/anoncvs.html= "); $handler->add("/family.html","/family/"); ?> where the 1st parameter to add() is the requested original URL, and the 2nd= =20 parameter is the URL to redirect to. =2D-=20 Cheers, Chris Howells -- chris@chrishowells.co.uk, howells@kde.org Web: http://chrishowells.co.uk, PGP ID: 0x33795A2C KDE/Qt/C++/PHP Developer: http://www.kde.org --nextPart3406812.K86LBuWXrz Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (FreeBSD) iD8DBQBBX+wQF8Iu1zN5WiwRAr7DAKCPXqAMhfFlG9bMtPbH0bbg2ZdFdgCeJuBY +AuAa0INShkxn0RdI7jSuSM= =DsPZ -----END PGP SIGNATURE----- --nextPart3406812.K86LBuWXrz--