icon33 Posted February 14, 2009 Share Posted February 14, 2009 I am starting a site where users will be able create pages and the pages will need to be displayed when the URL reads www.mysite.com/NewUser. The pages are database driven and are created based on User IDs I have not done this before and I'm looking for the best method to achieve this goal. Similar to myspace.com/User or Blackplanet.com/User thanx Quote Link to comment https://forums.phpfreaks.com/topic/145169-solved-wwwmysitecomnewuser/ Share on other sites More sharing options...
Zane Posted February 14, 2009 Share Posted February 14, 2009 mod_rewrite Quote Link to comment https://forums.phpfreaks.com/topic/145169-solved-wwwmysitecomnewuser/#findComment-761926 Share on other sites More sharing options...
blueman378 Posted February 14, 2009 Share Posted February 14, 2009 just a note, doing it your way you would have to take the username, (unless they enter the id?) check your database to find the userid, and then run the rest of the page off that, for this sort of thing i would suggest that you base your queries off there username. (assuming each username is unique) Quote Link to comment https://forums.phpfreaks.com/topic/145169-solved-wwwmysitecomnewuser/#findComment-761964 Share on other sites More sharing options...
blueman378 Posted February 14, 2009 Share Posted February 14, 2009 but anyway the basic logic you need is Options +FollowSymlinks RewriteEngine on RewriteRule ^([0-9a-z_]+)$ index.php?username=$1 [NC] which basically when a user types in eg mysite.com/john_doe the server will load mysite.com/index.php?username=john_doe Quote Link to comment https://forums.phpfreaks.com/topic/145169-solved-wwwmysitecomnewuser/#findComment-761976 Share on other sites More sharing options...
icon33 Posted February 20, 2009 Author Share Posted February 20, 2009 Thanks and that work GREAT!! - BUT - Now i need to know how to get the rest of the variables to register... http://www.e2minutesites.com/name will bring up the for the 'ID' that correlates with 'name' but how do i get my links in the page to work correctly. Site: http://www.e2minutesites.com/casana i want my links to still use show the 'name' in the URL like above - but there are variables that follow to get different pages http://www.e2minutesites.com/casana?additional_page=page_id - HELP! thnx again! Quote Link to comment https://forums.phpfreaks.com/topic/145169-solved-wwwmysitecomnewuser/#findComment-766838 Share on other sites More sharing options...
Q695 Posted February 20, 2009 Share Posted February 20, 2009 you're going to want to use mysql_real_escape_string Quote Link to comment https://forums.phpfreaks.com/topic/145169-solved-wwwmysitecomnewuser/#findComment-766850 Share on other sites More sharing options...
Q695 Posted February 20, 2009 Share Posted February 20, 2009 I smell someone who wants someone else to develop an entire website for free, or at least the layout of it. Quote Link to comment https://forums.phpfreaks.com/topic/145169-solved-wwwmysitecomnewuser/#findComment-766851 Share on other sites More sharing options...
icon33 Posted February 20, 2009 Author Share Posted February 20, 2009 thnx for the help - i think? Quote Link to comment https://forums.phpfreaks.com/topic/145169-solved-wwwmysitecomnewuser/#findComment-766854 Share on other sites More sharing options...
icon33 Posted February 20, 2009 Author Share Posted February 20, 2009 Got it all together: Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteRule ^([0-9a-z_]+)/([0-9a-z_]+)$ members.php?url=$1&id=$2 [NC] RewriteRule ^([0-9a-z_]+)/([0-9a-z_]+)/$ members.php?url=$1&id=$2 [NC] RewriteRule ^([0-9a-z_]+)$ members.php?url=$1 [NC] RewriteRule ^([0-9a-z_]+)/$ members.php?url=$1 [NC] Quote Link to comment https://forums.phpfreaks.com/topic/145169-solved-wwwmysitecomnewuser/#findComment-767410 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.