|
Posted by Terry Romine on 10/21/08 11:21
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. An example would be an agent named John Smith whose agentname would be jsmith. So the user would enter domain.com/jsmith and get the agent's profile.
I tried initially to dummy up a 404 page, where if the link was like: domain.com/jsmith that it would parse the agent name and pass it through to domain.com/agent_profile.php?agent=jsmith. It failed to work, ending up with a recursive call to the 404 page and getting hung.
Right now, I have directories set up for each agent, with an index.php that does the redirect. It's really getting to be a mess with so many directories.
I need to be able to check the mysql database for the agent name, and if found, do a redirect (header("Location: agent_profile.php?agent=agentID") and if not, continue to a standard 404 error page, or a "sorry not found" page.
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?
Terry
Navigation:
[Reply to this message]
|