TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   setting a users name in the url (http://www.talkphp.com/general/3402-setting-users-name-url.html)

sarmenhb 10-01-2008 04:37 PM

setting a users name in the url
 
in websites such as myspace.com when you create a user login your profile is myspace.com/your_user_name

how do they do that? (is that a auto created folder or?)

thanks

jcorradino 10-01-2008 05:13 PM

well, you can do it a clean way or a messy way

The messy way:

just use GET to call user.php?user=username

the clean way, do the above step, and mess with the .htaccess using RewriteRule to make it get rid of the "user.php?username=". you can do this by creating a .htaccess file and throwing this in there:

RewriteEngine on
Options +FollowSymLinks
RewriteRule user/(.*)/ user.php?username=$1

if you would like to see this working, take a look at my test page I put up to make sure the rewrite rule worked correctly. You can edit the name by changing the address bar.

Hope this helps


All times are GMT. The time now is 06:52 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0