RE: [PHP] 404 Not Found -> refresh to directory

2005-07-15 Thread Terry Romine
An interesting idea. I'll work on this next week and see how it goes. Can I 
ask: why two versions of $uriparams?

Terry

-Original Message-
From: Andras Kende <[EMAIL PROTECTED]>
Sent: Jul 14, 2005 9:53 PM
To: 'Terry Romine' <[EMAIL PROTECTED]>, 
        'php' 
Subject: RE: [PHP] 404 Not Found -> refresh to directory


.htaccess:
RewriteEngine on
RewriteRule ^([\w-]+)$ index.php/$1

index.php:




Best regards,

Andras Kende
http://www.kende.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] 404 Not Found -> refresh to directory

2005-07-14 Thread Andras Kende


-Original Message-
From: Terry Romine [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 14, 2005 3:52 PM
To: php
Subject: [PHP] 404 Not Found -> refresh to directory

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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



.htaccess:
RewriteEngine on
RewriteRule ^([\w-]+)$ index.php/$1

index.php:




Best regards,

Andras Kende
http://www.kende.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] 404 Not Found -> refresh to directory

2005-07-14 Thread Chris W. Parker
Terry Romine 
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.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php