Gossamer Forum
Home : General : Internet Technologies :

Error 404 Redirection (PHP)

Quote Reply
Error 404 Redirection (PHP)
I am working on a content management system for a client, and all the pages are dynamic and referenced via an ID number, so a specific page may be: http://www.domainname.com/?72

Let's say that ID #72 = "Marketing". I would like to be able to have is:

1. The user enter http://www.domainname.com/marketing

2. The computer to realize that /marketing does not exist and a PHP script would be called which would search for the word "marketing" in a database which would associate it with the ID #72 and redirect to http://www.domainname.com/?72.

3. If no record was found, then actually call the Error 404 error.

It all sounds good, but can it be done?
Quote Reply
Re: [Lee] Error 404 Redirection (PHP) In reply to
Hi,

Use:

ErrorDocument 404 /lookup.php

and then have lookup.php look at what URL was requested, do the search, and return the results. You'll want to double check that you are still returning the proper headers (i.e. not a 404, but rather a 200).

Cheers,

Alex
--
Gossamer Threads Inc.