You are here: 404 Not Found -> refresh to directory « PHP « IT news, forums, messages
404 Not Found -> refresh to directory

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация