But I would love to learn how to do this.
Say that my site is www.mysite.com. When users go to, say, www.mysite.com/username, it goes to there profile, similar to how Xanga does it.
Any tips or the code on how to do this would be greatly appreciated.
Not sure what this is called...
Started by pizzaboy9010, Mar 03 2006 12:11 AM
7 replies to this topic
#1
Posted 03 March 2006 - 12:11 AM
#2
Posted 03 March 2006 - 03:41 AM
i think you mean Mod_Rewrite, have a search around the forum, there are lots of questions on it atm, and also there is some good tutorials in the database.
#3
Posted 03 March 2006 - 04:10 PM
You would use mod rewrite to change that path, to a server/php friendly one that uses a query string. The use the $_GET variable to get the name out of the url, select the name from your database, and go from there.
#4
Posted 05 March 2006 - 02:19 PM
Another way of doing it would be to just create a folder for each user and have an index.php file within the folder, so when you go to yoursite.com/username the contents of index.php will be displayed.
#5
Posted 05 March 2006 - 03:12 PM
Quote
Another way of doing it would be to just create a folder for each user and have an index.php file within the folder, so when you go to yoursite.com/username the contents of index.php will be displayed.
that would just make things more messy, long time to set up and when it comes to updating it, you would have to do it multiple times, and i leant that the hard way myself.
#6
Posted 05 March 2006 - 03:12 PM
Coordinating between the possibly thousands of user folders, and a database that holds the user info would simply over complicate things. Through .htaccess its as simple as 2 short steps.
But, if .htaccess is unavailable for some reason, your way would be the only alternative i can think of if he want's to keep the clean url. Personally, i'd scrap the clean url if i had to make a folder for every user.
But, if .htaccess is unavailable for some reason, your way would be the only alternative i can think of if he want's to keep the clean url. Personally, i'd scrap the clean url if i had to make a folder for every user.
#7
Posted 05 March 2006 - 09:18 PM
My bad, I setup a site with an individual folder for each user. It kind of made more sense because when a user joins they're given certain files within their directory that they can edit. It was annoying making a function to create the dirs and to remove/clear the dirs. I'll try the .htaccess way.
#8
Posted 06 March 2006 - 01:02 AM
Thanks! Mod Rewrite works great!
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users
