PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Hi,
I'm building an application for a company and they wish to have a front page with a userbox on top of the site and the user's info. Instead of having to open a directory for each user, I'd rather pass the username on the url like this: "http://yourdomain.com/user". This way i can grab the user and look for his info on the database. I've read some posts online about editing the htaccess file but nothing seems to work for me.
Then in index.php (in the same directory as .htaccess), the variable $_GET['q'] will be everything after the first slash.
Here are some examples:
yourdomain.com/user34 will load index.php with $_GET['q'] = 'user34'
yourdomain.com/user34/edit will load index.php with $_GET['q'] = 'user34/edit' (you'd need to explode by '/')
yourdomain.com/user34?view=something OR yourdomain.com/user34&view=something will be $_GET = array('q'=>'user34' , 'view'=>'something)
yourdomain.com/images/img1.png, if it exists, will retrieve the image.