0

I would like to find a way for users to be able to type their username after my domain name to access their public profile page. For example, if you type youtube.com/username it shows that user's channel page. The resulting page is the same as youtube.com/user/username. So with my website, I have mydomain.example/users/profile.php?name=username It's a bit more complicated, with PHP and variables and subdirectories and everything... I would like that same page to display when I type mydomain.example/username I really have no idea where to start with this, but I suspect it would be something in the .htaccess file, which I do have access to. Thanks for any help!

edit: sorry this is a few days old, I've been having some other troubles and I haven't been able to test it until now. Anyway, it isn't working... Just to recap, I want mydomain.example/username to filter to mydomain.example/users/profile.php?name=username

Thanks..

edit2: I found this also on stackoverflow... link text i tried tweaking that, and what was mentioned here a few days ago... but it still won't work. Any ideas? I also keep finding pages that recommend the strategy this guy used: link text but it looks like that would cause more problems than it's worth. Any ideas?

Community
  • 1
  • 1
RobHardgood
  • 283
  • 1
  • 3
  • 6
  • I've created a "404 handler" page that takes the username like that, looks up the user's info in DB, then redirects to their profile.. so the /tim page never exists but redirect's to Tim's profile. – Tim Jun 27 '10 at 22:34

1 Answers1

3
RewriteEngine on
RewriteRule ^user/(.*)$ profile.php?name=$1 [NC,B,QSA]
Robus
  • 8,067
  • 5
  • 47
  • 67