Find jobs - Bob's Free Stuff Forum - Bad Credit Loans - Debt Consolidation - Debt Consolidation

PDA

View Full Version : URLs like MySpace, without folders for each user?


Arson
Sep 4th 2007, 9:36 pm
How would one go about using URL's like myspace does?

What I mean: On myspace, You can type in the url, www.myspace.com/usernamehere, and It will take you to that username's profile.

My question is, how do I do that, without making an actual folder for the user.

Say I go to mysite.com/joe

I want it to find the username "joe" in the database, and show the information for that user.

So is there even a way to do that without actually creating a folder for each user? Id think there would be, or else that would mean MySpace has millions of folders on their servers...

+Rep to helpers! Thanks in advance!

craze3
Sep 4th 2007, 9:39 pm
I was just about to post the same question! Thanks for bringing this up, I was having a hard time thinking of how to explain it :D
Reason I ask is because PHPLD does the same thing w/ the categories but i doubt they do any htaccess modding or any server side editing stuff..hmmm

Arson
Sep 4th 2007, 9:41 pm
lol no problem.

I was going to post earlier, but thought of a way I might be able to do it, unfortunately It didn't work...:(

CriminalOrigins
Sep 4th 2007, 9:43 pm
You can use mod_rewrite to do this.

Check out http://modrewrite.com, I'd recommend the forums there if you need help.

Arson
Sep 4th 2007, 9:47 pm
Thanks. Does anyone have a specific code or function that is made to do it though?

loibeignacio
Sep 5th 2007, 12:34 am
yeah some htaccess / mod_rewrite stuffs ;)

from:

yoursite.com/users.php?user=loibeignacio

to:

yoursite.com/loibeignacio/ or yoursite.com/loibeignacio.html

nico_swd
Sep 5th 2007, 12:38 am
RewriteEngine On
RewriteRule ^([\w-]+)$ scriptname.php?username=$1