TylerDiaz Posted March 29, 2009 Share Posted March 29, 2009 I have googled it and tried finding how it is done, but not much luck. So i come asking fellow php developers. You know how on twitter and a couple of other sites when you register you get a custom directory according to your registered username? How is that acomplished? Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted March 29, 2009 Share Posted March 29, 2009 One solution would be to use mod_rewrite: RewriteRule ^([a-z0-9]+)$ profile.php?username=$1 Check out the documentation for a more elaborate explanation of how it works. It's sort of the same thing we've done here: http://www.phpfreaks.com/profile/Daniel0. We just put /profile in front of the username. It's not really a directory, but the URL is rewritten to another URL that exists. Quote Link to comment Share on other sites More sharing options...
TylerDiaz Posted March 29, 2009 Author Share Posted March 29, 2009 One solution would be to use mod_rewrite: RewriteRule ^([a-z0-9]+)$ profile.php?username=$1 Check out the documentation for a more elaborate explanation of how it works. It's sort of the same thing we've done here: http://www.phpfreaks.com/profile/Daniel0. We just put /profile in front of the username. It's not really a directory, but the URL is rewritten to another URL that exists. Hmm i seem to be understanding the concept. Think you can provide a bit more indepth of an explination? Do i modify the .htaaccess and add the code there or? 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.