title: .htaccess rewrite for user profile page
body: <p>So, I want the following:</p>
  
  <p>When a user types in browser: <code>mydomain/user/their_username</code>
  I want that the user gets to see his profile page. The profile page is a page called user.php in my root directory. The user.php file needs a <code>$user</code> var set. So when user.php gets requested, the url should be: mydomain/user.php?user=their_username</p>
  
  <p>So from <code>mydomain/user/their_username to mydomain/user.php?user=their_username</code> </p>
  
  <p>The user is only allowed to enter a to z (capitals are allowed), numbers and an underscore. Anything else should redirect them to an error page. Also, their should be no error if the user types in a slash at the end. </p>
  
  <p>What should I put in my htaccess file? </p>
  
  <p>(I am using xampp to test my code)</p>