Re: Interesting Question (honest :O)
| From: | Brian Clark | Date: | Thu, 04 Jan 2001 23:24:26 +0000 |
| Subject: | Re: Interesting Question (honest :O) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-32768@lists.php.net to get a copy of this message | ||
Hello Gareth,
(GD == "Gareth Davies") garethdavies@frogtrade.com writes:
GD> How do I trap a request for a none existant page on my server with
GD> a php page? My reason for wanting to do this is so that people can
GD> access my domain with an extension of their own company name, e.g.
GD> www.mydomain.com/company - Rather than creating loads of little
GD> html pages, one for each "company" name, I want to automatically
GD> redirect any failed page requests to a generic php file that can
GD> then check a database and present whatever page is relevant to the
GD> "company" name given.
Using an .htaccess file (or httpd.conf itself):
ErrorDocument 404 /errordocs/404.php
Or similar. Check the Apache online docs.
Of course the 404.php file would work it's magic, but that's up to you
to decide what magic that should be -- your database query, reporting
etc.
GD> Hope that makes sense. Not sure if it's PHP, probably Apache, but
GD> figured you guys were more likely to know the answer than the
GD> Apache forums.
I'm sure they'd have given you just about the same advice.
GD> Thank you in anticipation.
-Brian