views:

57

answers:

1

Simply put, when a user wants people to be able to go to their profile, we want them to be able to just say go to mydomain.com/username. The real user page would be at something like mydomain.com/users/page.php?id=1325 which doesn't really help users.

The problem: I've been doing PHP for some time, and have never had the need to do this. I don't have a clue where to even start? I wouldn't want to do something as naive as just creating actual folders with redirects in them or something....

Can anybody tell me how to go about this in php?

Y'all are the greatest!

+10  A: 

Provided you are on an apache server look up .htaccess and mod_rewrite, it all happens outside of PHP.

Example for your .htaccess:

RewriteEngine on
RewriteRule ^([0-9a-zA-Z]+)([\/]?)$ /user/profile.php?name=$1 [L]
Steve H
mod_rewrites are about as confusing as they can be but I got it. Thanks a lot. Perfect.
Cyprus106