verdrm Posted May 30, 2009 Share Posted May 30, 2009 Hey Guys, I'd like to know how to redirect usernames to pages. For example: www.myspace.com/username redirects to their corresponding profile page How does that work? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/160226-redirecting-usernames-to-pages/ Share on other sites More sharing options...
.josh Posted May 30, 2009 Share Posted May 30, 2009 google mod rewrite Quote Link to comment https://forums.phpfreaks.com/topic/160226-redirecting-usernames-to-pages/#findComment-845448 Share on other sites More sharing options...
fullyscintilla Posted May 30, 2009 Share Posted May 30, 2009 uhh thats just a directory in which their page is stored... aka mysite.com/mypage when you create your account you have to specify this variable which is then used to populate a directory with a default profile template. The template is then populated with the information you entered during sign up and any info therein after. Quote Link to comment https://forums.phpfreaks.com/topic/160226-redirecting-usernames-to-pages/#findComment-845472 Share on other sites More sharing options...
.josh Posted May 30, 2009 Share Posted May 30, 2009 so you think creating a new directory for every new user, with an instance of a page for every single user, is the better alternative to having a single script that dynamically generates the user's content from a database, and using a system (mod rewrite) where you can enter in a "friendly" url and the server parses it and loads up that single page, passing the name to it? Quote Link to comment https://forums.phpfreaks.com/topic/160226-redirecting-usernames-to-pages/#findComment-845481 Share on other sites More sharing options...
fullyscintilla Posted May 30, 2009 Share Posted May 30, 2009 sorry i'm going to go kill myself now since i'm obviously a waste of life. Ya know i love how I'm only on here cuz i'm bored and i'm trying to help... and all anyone can ever seem to do is bash me. thanks Quote Link to comment https://forums.phpfreaks.com/topic/160226-redirecting-usernames-to-pages/#findComment-845483 Share on other sites More sharing options...
fullyscintilla Posted May 30, 2009 Share Posted May 30, 2009 this website especially... I mean.. obviously something is wrong with me.. I do this for a living and I don't use mod rewrite.. maybe i should see a therapist because honestly the way you replied just now makes me want to slit my throat. Quote Link to comment https://forums.phpfreaks.com/topic/160226-redirecting-usernames-to-pages/#findComment-845485 Share on other sites More sharing options...
.josh Posted May 30, 2009 Share Posted May 30, 2009 I asked an honest question. You aren't the only one around here that "does this for a living." The fact that you prefer that method over mod rewrite in my mind either makes you retarded or brilliant. I was trying to give you the benefit of the doubt, because I'm always up for learning something. I'm humble enough to recognize that I'm not perfect. If I were going to just write you off as retarded I would have expressed myself in like manner. Like right now. You're being retarded for assuming that I'm out to get you. Quote Link to comment https://forums.phpfreaks.com/topic/160226-redirecting-usernames-to-pages/#findComment-845539 Share on other sites More sharing options...
Garethp Posted May 30, 2009 Share Posted May 30, 2009 Like Crayon said, people who are good at PHP are good because they never stop learning. Assume that your the best, and you'll never get anywhere. Assume that everyone else is as good as you or better, and you'll always be learning new ways to do things better. Like right now, you have the chance to learn about mod rewrite, which is very efficient Quote Link to comment https://forums.phpfreaks.com/topic/160226-redirecting-usernames-to-pages/#findComment-845555 Share on other sites More sharing options...
.josh Posted May 30, 2009 Share Posted May 30, 2009 I was hoping for an opportunity to learn some arcane reason why his method is better. Stuff like that is gold. But considering I just read in some whine thread of his that he's been programming in php for 4 years and never knew it supported OOP makes me think I'm about to be disappointed. Quote Link to comment https://forums.phpfreaks.com/topic/160226-redirecting-usernames-to-pages/#findComment-845565 Share on other sites More sharing options...
PugJr Posted May 30, 2009 Share Posted May 30, 2009 RewriteEngine on rewriterule ^([A-Za-z0-9-]+)/?$ userlookupview.php?id=$1 Add that to your .htaccess and you should be able to do it. Quote Link to comment https://forums.phpfreaks.com/topic/160226-redirecting-usernames-to-pages/#findComment-845582 Share on other sites More sharing options...
MadTechie Posted May 30, 2009 Share Posted May 30, 2009 Doing something for a living doesn't mean your any good at it, if you have a strong case then you can't really get "bashed", instead of saying you got bashed you either read up on what they are saying and come back with reasons yours is better or say your bashing me and not learn anything new, Whenever i have conflicts with anyone (including CV) about something I am unsure of I choose to look into what they say and/or read up on what i believe, (to validate it), either way by the end of it, i either have a new improved approach or a better understanding of what other options their are and when i should or should not use them. In most case i would use a "mod rewrite" but in some case that's not be possible Quote Link to comment https://forums.phpfreaks.com/topic/160226-redirecting-usernames-to-pages/#findComment-845700 Share on other sites More sharing options...
Garethp Posted May 30, 2009 Share Posted May 30, 2009 Whenever I get "bashed" I shut up, stop arguing, and ask more about their method Quote Link to comment https://forums.phpfreaks.com/topic/160226-redirecting-usernames-to-pages/#findComment-845703 Share on other sites More sharing options...
MadTechie Posted May 30, 2009 Share Posted May 30, 2009 Remember the personl whos "bashing" could be wrong! Quote Link to comment https://forums.phpfreaks.com/topic/160226-redirecting-usernames-to-pages/#findComment-845704 Share on other sites More sharing options...
Garethp Posted May 30, 2009 Share Posted May 30, 2009 Yeah, but if they're wrong, I learn something new, gain the respect of my peers (I hope) and I have more of a variety of techniques to choose from in the future Quote Link to comment https://forums.phpfreaks.com/topic/160226-redirecting-usernames-to-pages/#findComment-845706 Share on other sites More sharing options...
MadTechie Posted May 30, 2009 Share Posted May 30, 2009 Sorry your wrong, Just kidding your right or we're both wrong..!! Quote Link to comment https://forums.phpfreaks.com/topic/160226-redirecting-usernames-to-pages/#findComment-845709 Share on other sites More sharing options...
Garethp Posted May 30, 2009 Share Posted May 30, 2009 Who's wrong? Wait, I'm right? Since when am I right? What am I right about? But aren't I wrong? God! Your more confusing than RegEx Quote Link to comment https://forums.phpfreaks.com/topic/160226-redirecting-usernames-to-pages/#findComment-845710 Share on other sites More sharing options...
nrg_alpha Posted May 30, 2009 Share Posted May 30, 2009 In most case i would use a "mod rewrite" but in some case that's not be possible Ain't that the truth.. until recently, my hosting provider allowed this.. so I was able to use .htaccess for redirects and whatnot...It wasn't until my ftp account was compromised (poor password setup on my part).. Once the malware was removed (and I changed to a better strength password), Poof! No more .htaccess Also removed was the ability for application level gzip encoding I'm really going to have to learn to set up and make us of a VPS one of these days, as this chaps my rear end. Quote Link to comment https://forums.phpfreaks.com/topic/160226-redirecting-usernames-to-pages/#findComment-845798 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.