title: Hide directory name from URL
body: <p>I just want to hide the dir name from URL.</p>
  <p><strong>From</strong>: <code>example.com/dirname/somepage</code>
  <strong>To</strong>: <code>example.com/somepage</code></p>
  <p>That code doesn't work for me, I have probably made some mistakes</p>
  <pre><code>RewriteBase /
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule    /  /dir/$1    [L]
  </code></pre>
  <p>I have already this in .htaccess (to hide php extension)</p>
  <pre><code>RewriteEngine On
  RewriteCond %{REQUEST_FILENAME}.php -f
  RewriteCond %{REQUEST_URI} !/$
  RewriteRule (.*) $1\.php [L]
  </code></pre>