sleith Posted April 11, 2008 Share Posted April 11, 2008 is there any way to generate unique URL for user like multiply do? Example: brainyskeeta.multiply.com thedudeoforkut.multiply.com thanks Quote Link to comment https://forums.phpfreaks.com/topic/100586-generate-url/ Share on other sites More sharing options...
Northern Flame Posted April 11, 2008 Share Posted April 11, 2008 i know how to do it like this: http://www.yourwebsite.com/username if you want it like that.... Quote Link to comment https://forums.phpfreaks.com/topic/100586-generate-url/#findComment-514441 Share on other sites More sharing options...
ohdang888 Posted April 11, 2008 Share Posted April 11, 2008 ya they're called sub-domians.... but its a whoile lot more easier just to do something like thise.. index.php?profile_id= blah or what notrhern flames said. Quote Link to comment https://forums.phpfreaks.com/topic/100586-generate-url/#findComment-514443 Share on other sites More sharing options...
sleith Posted April 11, 2008 Author Share Posted April 11, 2008 i know how to do it like this: http://www.yourwebsite.com/username if you want it like that.... How to do that? is it by creating folder for each user? @ohdang888: is there any way generate subdomain automaticaly? Quote Link to comment https://forums.phpfreaks.com/topic/100586-generate-url/#findComment-514452 Share on other sites More sharing options...
Northern Flame Posted April 11, 2008 Share Posted April 11, 2008 no you would not need to create a sub-directory for each user, it can be done with .htaccess ex: RewriteEngine on RewriteRule ^([^/\.]+)/?$ users.php?user=$1 [L] this will display as: http://www.website.com/username and send "username" to users.php as an $_GET variable, so you can call it with echo $_GET['user'] in users.php Quote Link to comment https://forums.phpfreaks.com/topic/100586-generate-url/#findComment-514455 Share on other sites More sharing options...
sleith Posted April 11, 2008 Author Share Posted April 11, 2008 no you would not need to create a sub-directory for each user, it can be done with .htaccess ex: RewriteEngine on RewriteRule ^([^/\.]+)/?$ users.php?user=$1 [L] this will display as: http://www.website.com/username and send "username" to users.php as an $_GET variable, so you can call it with echo $_GET['user'] in users.php Thanks about the info. I'll learn about RewriteEngine Btw, how about url on subdomain level like thedudeoforkut.multiply.com ? Quote Link to comment https://forums.phpfreaks.com/topic/100586-generate-url/#findComment-514473 Share on other sites More sharing options...
Daniel0 Posted April 11, 2008 Share Posted April 11, 2008 That would work the same way, but then you need to make sure that all subdomains are handled by the same vhost. Quote Link to comment https://forums.phpfreaks.com/topic/100586-generate-url/#findComment-514482 Share on other sites More sharing options...
redarrow Posted April 11, 2008 Share Posted April 11, 2008 Here a little fast example you can also do....... <?php $i=array("peeter"=>"00005","paul"=>"00006","harry"=>"00007","john"=>"00008"); foreach($i as $username => $id){ echo"<a href='".$_SERVER['PHP_SELF']."?profile=$username'>$username</a><br><br>"; if($_GET['profile']=="$username"){ switch($username){ case $username: echo "your name is $username with id $id <br><br>"; brake; } } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/100586-generate-url/#findComment-514498 Share on other sites More sharing options...
sleith Posted April 11, 2008 Author Share Posted April 11, 2008 Here a little fast example you can also do....... <?php $i=array("peeter"=>"00005","paul"=>"00006","harry"=>"00007","john"=>"00008"); foreach($i as $username => $id){ echo"<a href='".$_SERVER['PHP_SELF']."?username=$username'>$username</a><br><br>"; if($_GET['username']=="$username"){ switch($username){ case $username: echo "your name is $username with id $id <br><br>"; brake; } } } ?> it is to do like "www.xyz.com/username=sleith" right? i already know that one. i need to directly "sleith.xyz.com" That would work the same way, but then you need to make sure that all subdomains are handled by the same vhost. Thanks for the info Quote Link to comment https://forums.phpfreaks.com/topic/100586-generate-url/#findComment-514500 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.