RE: [PHP] 404 Not Found -> refresh to directory
| From: | Chris W. Parker | Date: | Thu, 14 Jul 2005 21:05:59 +0000 |
| Subject: | RE: [PHP] 404 Not Found -> refresh to directory | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-218716@lists.php.net to get a copy of this message | ||
Terry Romine <mailto:terry_romine@earthlink.net>
on Thursday, July 14, 2005 1:52 PM said:
> I have a website that has several hundred agents in a mysql database.
> The client wants to be able to enter the domain.com/agentname and be
> redirected to a standard page where we show the agent information.
[snip/]
> I think my question is: is there an easy way to use a 404 page
> written in php to capture the parameters from the missing page
> request and test against a db, resulting in either a valid page
> redirect or a not found redirect?
Never tried it, but this is super easy to do with mod_rewrite and
.htaccess.
## DEFINE REWRITE RULES
RewriteEngine on
RewriteRule ^([\w-]+)$ yourpage.php?agent=$1
Should work (maybe).
Chris.