title: Creating user friendly URL with directory
body: <p>I have a page where the user signs up and they're redirected to their profile. Their profile URL is: example.com/profiles/?username=sam, where sam can be any name. This works successfully, but i'm trying to make the URL cleaner. I want to make the URL look like this: example.com/profiles/sam Here's my .htaccess:</p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
  
  RewriteEngine On
  
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^([^\.]+)$ $1.php [NC,L]
  RewriteCond %{THE_REQUEST} /profiles/?\?username=([^&amp;\s]+) [NC]
  RewriteRule ^ /profiles/%1? [L,R]
  RewriteRule ^(?:profiles/)?([0-9]+)/?$ /profiles/?username=$1 [L]
  
      SetOutputFilter DEFLATE
      &lt;IfModule mod_setenvif.c&gt;
          # Netscape 4.x has some problems...
          BrowserMatch ^Mozilla/4 gzip-only-text/html
  
          # Netscape 4.06-4.08 have some more problems
          BrowserMatch ^Mozilla/4\.0[678] no-gzip
  
          # MSIE masquerades as Netscape, but it is fine
          # BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
  
          # NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
          # the above regex won't work. You can use the following
          # workaround to get the desired effect:
          BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
  
          # Don't compress images
          SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary
      &lt;/IfModule&gt;
      &lt;IfModule mod_headers.c&gt;
          # Make sure proxies don't deliver the wrong content
          Header append Vary User-Agent env=!dont-vary
      &lt;/IfModule&gt;
  &lt;/IfModule&gt;
  </code></pre>
  
  <p>profiles in example.com/profiles/ is a directory. Inside profiles is an index.php file, this is the PHP file that creates the dynamic page. My .htaccess file is located in the root folder. I am also using GoDaddy. GoDaddy states that: "Because enabling mod_rewrite is handled at a global level, you do not need to enable it in your httpd.conf file. You only need to add the desired code to the body of your .htaccess file. The .htaccess file containing the rewrite rules must be in the same directory as the target files." </p>
  
  <p>With my .htaccess like that, it changes the URL from example.com/profiles/?username=sam to example.com/profiles/sam but the profile is not shown at all, instead a 404 error page is shown, meaning the page does not exist. The page should exist. Also, adding Options +Multiviews produces the same 404 error. Also with Options +Multiviews, some pages display the CSS instead of the PHP page. </p>
  
  <p>How can I make it so that example.com/profiles/?username=sam is redirected to example.com/profiles/sam and make the profile page actually show up?</p>