title: Apache rewrite rules inside a virtual host
body: <p>I'm having some trouble with migrating my rewrite rules from <code>.htaccess</code> to a <code>VirtualHost</code>.</p>
  
  <p>When I'm using below Directory outside the <code>VirtualHost</code> it works, but I get some authentication errors - so I'm wondering to what I should change it to make it work inside the <code>VirtualHost</code>.</p>
  
  <p>Or should they be added to <code>&lt;Directory /var/www/server/&gt;</code></p>
  
  <p>Rules:</p>
  
  <pre><code>&lt;Directory /var/www/server/subfolder/&gt;
      RewriteEngine On
      RewriteCond $1 !^(index\.php|images|js|css|robots\.txt)
      RewriteRule ^(.*)$ /subfolder/index.php/$1 [L]
  &lt;/Directory&gt;
  </code></pre>
  
  <p>VirtualHost:</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
  ServerAdmin admin@server.com
  Servername server.com
  ServerAlias server2 server2.com server server.com
  
  DocumentRoot /var/www/server
  
  &lt;Directory /&gt;
      Options FollowSymLinks
      AllowOverride None
  &lt;/Directory&gt;
  
  &lt;Directory /var/www/server/&gt;
      AuthType NTLM
      AuthName Server
      require valid-user
  
      PythonAuthenHandler pyntlm
      PythonOption Domain SERVER.COM
      PythonOption PDC xxx.xxx.xxx.xxx
      PythonOption BDC xxx.xxx.xxx.xxx
  
      Order allow,deny
      Allow from all
  &lt;/Directory&gt;
  
  ErrorLog ${APACHE_LOG_DIR}/server.com_error.log
  
  # Possible values include: debug, info, notice, warn, error, crit,
  # alert, emerg.
  LogLevel warn
  
  CustomLog ${APACHE_LOG_DIR}/server.com_access.log combined env=!nolog
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>Thanks in advance.</p>