NYCPHP Meetup

NYPHP.org

[nycphp-talk] Howto create custom URLs

csnyder chsnyder at gmail.com
Mon Mar 26 08:46:31 EDT 2007


On 3/19/07, Ben Sgro (ProjectSkyline) <ben at projectskyline.com> wrote:

> Currently I have a software package that creates URLS in this manner:
> myhost.com/index.php?act=700&eventid=4e732ced3463d06de0ca9a15b6153677
>
> Now, I want to make this a bit more user friendly and create URLs like:
> myhost.com/MayEvent07
>
> I'm not sure if I will have the ability to run apache
> mods (if that's the answer).

The correct approach to this, in my opinion, is to create an
application proxy -- a script that will parse incoming request for uri
MayEvent07, convert it into $_GET['eventid'] = 4e...7 using a db
lookup, and then include() the software package's index.php, using an
output buffer so that the urls in the software package's response can
all be converted back to your friendly format.

In other words, build a php wrapper around your software package. Done
right, it won't know the difference, and you don't have to muck around
with httpd.conf.

-- 
Chris Snyder
http://chxo.com/



More information about the talk mailing list