PHP Url Shortcut

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nowhere903
Forum Newbie
Posts: 9
Joined: Mon May 01, 2006 9:46 am

PHP Url Shortcut

Post by nowhere903 »

I am completely a newbie.
On my site I want to do the following:

When a user types in http://www.mysite.com/username

I want "username" to be checked in the database table and then redirected to a page displaying that information along that table.

Kind of like viewing a profile.

I can't find anything on this subject. What do I need to do?

Any code examples or links to other topics on this subject would be appreciated.

Thanks in advance.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

What have you searched for already? A websearch with the terms 'url rewriting' or 'mod_rewrite' will provide you various examples and inspiration.. Even a search on this forum would return lots of resources.
nowhere903
Forum Newbie
Posts: 9
Joined: Mon May 01, 2006 9:46 am

Post by nowhere903 »

I have been searching for "url PHP shortcut" etc. ALong those terms. I will search with the given strings you have gave me. Is there anything set in stone with the exact result I am trying to achieve.
Thanks for the quick reply.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

I presume that you already know how to write a script that displays the account information if the id is given...

Usually it's as simple as having a rewrite rule that maps /accounts/(.*) to /account.php?id=$1...
Post Reply