Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

URL Simplification Trick Help

Status
Not open for further replies.

AdamGHA

IS-IT--Management
Jul 7, 2003
1
US
Hi :),

Basically, I'm working on a project with member pages that I want to simplify. I'm really stumped and my friend who's doing the programming is clueless. Right now pages are located at...


(the members 'directory' is actually members.php--I have a forcetype set up)

To make things simpler for users, I'd like them to be able to type:


and for it to redirect to their page.

Is there any way to edit the server/domain's information so that if someone types it automatically forwards to


Like if someone types:

-- the server sees that there's no directory named adam so it automatically forwards that person to:
That would solve the problem. I'm just not sure if this is possible. I'd be infinitely grateful if someone could help (and I'm sure every member would be grateful too!)

Thanks so much!

-Adam Ghahramani
 
You could create a 404 page written in PHP which checks if a user by the name exists. Something like:
[tt]<?php
$username = basename($_SERVER['REQUEST_URI']);
/* check if a user by $username exists... */
if (exists($username))
header('Location: /members/' . $username);
else
echo &quot;Page not found.&quot;;
?>[/tt]
If the above file is saved as error.php, you would have to add
[tt]ErrorDocument 404 /error.php[/tt]
to your [tt]httpd.conf[/tt].

//Daniel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top