Re: Best Practice to Create Dynamic URL's- With Username
| From: | Tommy Pham | Date: | Mon, 21 Sep 2009 08:00:54 +0000 |
| Subject: | Re: Best Practice to Create Dynamic URL's- With Username | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-298213@lists.php.net to get a copy of this message | ||
----- Original Message ----
> From: Gaurav Kumar <kumargauravjukebox@gmail.com>
> To: php-general@lists.php.net
> Sent: Monday, September 21, 2009 12:54:30 AM
> Subject: [PHP] Best Practice to Create Dynamic URL's- With Username
>
> Hi All,
>
> I am creating a social networking website. I want that every user should
> have there own profile page with a static URL like-
>
> http://www.abcnetwork/user/username
>
> Where username will be dynamic userid or something else.
>
> This is something very similar to www.youtube.com/user/kumargauravmail (this
> is my profile page).
>
> So what should be the best practice to create such DYNAMIC URL's OR what
> kind of methodology youtube is following?
>
> Thanks in Advance.
>
> Gaurav Kumar
> OSWebstudio.com
Assuming the 'username' is from DB, look into URL rewrite. Thus, client see this
http://www.abcnetwork/user/username
which translates into this (or something similar) to PHP
http://www.abcnetwork/userProfile.php?user=username
Of course, you'll need to handle the 404 just in case ;)
Regards,
Tommy