title: .htaccess routing in domain ip with ~user parameter (apache UserDir)
body: <p>I've developed an application in PHP using a routing system through <code>.htaccess</code> and until today, I've managed to deploy this application in any server environment without any problems.  </p>
  
  <p>Today, a client of mine asked me to deploy the application to it's server that doesn't have any domain associated yet, and for that reason, he provided me the IP address for me to test if everything was ok. The problem is that this IP requires a username parameter to be present in the URL and that is causing the execution to always be redirected to the servers default 404 error page.</p>
  
  <p>The IP is something like this (some values have been altered):</p>
  
  <pre><code>http://192.185.65.31/~gef/
  </code></pre>
  
  <p>If I execute just that link without any additional parameters, I can reach my <code>serverindex.php</code> file that is configured to be my <code>DirectoryIndex</code> in <code>.htaccess</code>.
  But if I try to add anymore parameters like the language for example (<code>en/</code>), I'm automatically redirected to the 404 page.  </p>
  
  <p>My <code>.htaccess</code> routing configuration is as follows:</p>
  
  <pre><code>DirectoryIndex serverindex.php
  
  RewriteEngine On
  
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . serverindex.php
  </code></pre>
  
  <p>This configuration always allowed me to receive and manipulate an URL like the example bellowe:</p>
  
  <pre><code>Example: http://example.com/param1/param2/param3
  
  Array
  (
      [0] =&gt; param1
      [1] =&gt; param2
      [2] =&gt; param3
  )
  </code></pre>
  
  <p>How can I set <code>.htaccess</code> so that I leave the username untouched in the URL (so the server can process it and log the correct user account), and pass the following data as parameters into the application?</p>
  
  <pre><code>Example: http://example.com/~username/p1/p2/p3
  
  Array
  (
      [0] =&gt; p1
      [1] =&gt; p2
      [2] =&gt; p3
  )
  </code></pre>