title: URL rewrite with .htaccess for login and profile system
body: <p>I have a website where the url is <code>localhost/project/profile.php?user=username</code>and I am trying to get the url to look like this: <code>localhost/project/username</code> </p>
  
  <p>The most I am able to do is get rid of the <code>.php</code> by using the following code:</p>
  
  <pre><code>Options +FollowSymLinks -MultiViews
  
  RewriteEngine On
  RewriteBase /
  
  RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
  RewriteRule ^ %1 [R,L,NC]
  
  RewriteCond %{REQUEST_FILENAME}.php -f
  RewriteRule ^ %{REQUEST_URI}.php [L]
  </code></pre>
  
  <p>but that is not what I need right now.
  Here is the code that is meant to be changing the url - I got it off of another thread.</p>
  
  <pre><code>Options FollowSymLinks
  RewriteEngine on
  RewriteBase /
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ /index.php?user=$1 [L,QSA]
  </code></pre>
  
  <p>but it obviously doesn't work.</p>
  
  <p>I need to be able to go to the url: <code>localhost/project/username</code> and it registers as the original URL <code>localhost/project/profile.php?user=username</code></p>
  
  <p>** THE ANSWER **</p>
  
  <p>Thanks to <strong>Howlin</strong></p>
  
  <pre><code>RewriteEngine On
  
  RewriteCond %{THE_REQUEST} ^(GET|POST)\ /project/profile\.php\?user=(.*)\ HTTP
  RewriteRule ^ /project/%2\? [R=301,L]
  
  RewriteCond %{QUERY_STRING} !user=
  RewriteRule ^(.*)$ /project/profile.php?user=$1 [L]
  </code></pre>