title: apache rewriterule for tilda ~user folder
body: <p>I'm trying to get domain.com/~userX folders working without using userdir.</p>
  <p>It works fine when the ~userX folders are in the server doc root doc folder, but there's too many and need to put them in a sub folder, ie /homepages so the best I've gotten is in .htaccess:</p>
  <pre><code>&lt;IfModule mod_rewrite.c&gt; 
  RewriteEngine On
  RewriteBase /
  
  RewriteRule ^~ &quot;/homepages/%{REQUEST_URI}&quot;
  
  &lt;/IfModule&gt;
  Options -Indexes 
  
  </code></pre>
  <p>With the trailing slash it works fine:
  domain.com/~userX/</p>
  <p>Without the trailing slash it automatically redirects to:
  <a href="http://ddomain.com/homepages/%7EuserX/" rel="nofollow noreferrer">http://ddomain.com/homepages/~userX/</a></p>
  <p>Which I don't want, so I thought I would turn directory slash off:</p>
  <pre><code> &lt;Directory /var/www/domain/public_html&gt;
                  Options Indexes FollowSymLinks
                  AllowOverride All
                  Require all granted
                  DirectorySlash Off
          &lt;/Directory&gt;
  </code></pre>
  <p>The trailing slash still works but without the trailing slash I now get:</p>
  <pre><code>Forbidden
  You don't have permission to access this resource.
  </code></pre>
  <p>error log:</p>
  <p>Cannot serve directory /var/www/domain/public_html/homepages/~userX</p>
  <p>This is over my head, I've search for a few days and I'm really stuck :/</p>
  <p>Any help much appreciated thanks.</p>