title: .htaccess mod_rewrite not working in subdirectory
body: <p>I am trying to use htaccess to rewrite all requests to main.php in a subfolder on my domain. The code in my .htaccess is the following:</p>
  
  <pre><code>RewriteEngine on
  RewriteBase /public
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule . main.php [L]
  </code></pre>
  
  <p>I am sure the module is enabled, I have checked using the <code>apache2ctl -M</code> command</p>
  
  <pre><code>root@vps847:/etc/apache2/sites-available# apache2ctl -M
  Loaded Modules:
   core_module (static)
   log_config_module (static)
   logio_module (static)
   mpm_prefork_module (static)
   http_module (static)
   so_module (static)
   alias_module (shared)
   auth_basic_module (shared)
   authn_file_module (shared)
   authz_default_module (shared)
   authz_groupfile_module (shared)
   authz_host_module (shared)
   authz_user_module (shared)
   autoindex_module (shared)
   cgi_module (shared)
   deflate_module (shared)
   dir_module (shared)
   env_module (shared)
   mime_module (shared)
   negotiation_module (shared)
   php5_module (shared)
   reqtimeout_module (shared)
   rewrite_module (shared)
   setenvif_module (shared)
   ssl_module (shared)
   status_module (shared)
  Syntax OK
  </code></pre>
  
  <p>In my default site I have added/edited the following lines:</p>
  
  <pre><code>&lt;Directory /var/www/&gt;
          Options Indexes FollowSymLinks MultiViews
          AllowOverride All
          Order allow,deny
          allow from all
  &lt;/Directory&gt;
  &lt;Directory /var/www/public&gt;
          AllowOverride All
  &lt;/Directory&gt;
  </code></pre>
  
  <p>I have restarted apache every time after editing something. Yet, everty time I surf to the public directory I see the apache directory listing. I have already tried to add a .htaccess to the root of my apache, but it didn't work either. When I add an error to my .htaccess file I do get an internal server error though.</p>
  
  <p>Can someone find what is wrong with my configuration? I am using Ubuntu server 12.04.</p>