I have a URL like http://domain.com/index.php?user=test
When a user logs in, I want to show a URL like http://domain.com/user (user will be dynamic).
How might I achieve this with URL rewriting using PHP?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You should use something based off .htaccess. Take WordPress’ for instance:
This says grab any page which does not exist (such as “user” in your case), and redirect to the main
index.phpfile.That main
index.phpcan then grab the “user”, and you can use it to grab data from your database and show whatever you want.EDIT– similar to AlienWebguy’s answer