rabu Posted February 25, 2007 Share Posted February 25, 2007 Hi, I'm fairly new to PHP, and have a question I hope one of you guys can help me with. I was wondering how to make it possible for the users of a site (that I'm currently working on) to have a unique URL, as their username - e.g.: www.site.com/username1, www.site.com/username2 and so on... I really hope some one, can help me with a point of direction or some resource or tutorial links. Kind regards, - Ras Quote Link to comment Share on other sites More sharing options...
ted_chou12 Posted February 25, 2007 Share Posted February 25, 2007 I believe you should have a search in google, ".htaccess" + redirection , you will get something or tutorial. If you still cant find anything, I will try to explain it to you. Ted Quote Link to comment Share on other sites More sharing options...
rabu Posted February 25, 2007 Author Share Posted February 25, 2007 Okay thanks, I have been looking at it. So you mean that something like this: RewriteRule ^([A-Za-z0-9-]+)/?$ username.php?username=$1 [L] would do the trick. I case a user types in this URL: www.site.com/username1, then my PHP-file (username.php) will get the parameter username=username1 (www.site.com/username.php?username=username1)? But wont that be visible in the browser URL to the end-user (www.site.com/username.php?username=username1)? Or does the browser URL still stick with www.site.com/username1 - when I'm using the "RewriteRule"? Thanks for your help so far, but would like to get the question above clarified if you know about that. Thanks, - Ras Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 25, 2007 Share Posted February 25, 2007 If you use the [NC] tag instead of [L] they will not see the change. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.