title: Apache Multiple Rewrite Rules
body: <p>I have a 2 sets of rewrite rules. This is the Virtual Host:</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
      ServerName datingjapan.co
      ServerAlias *.datingjapan.co
      RewriteEngine on
      RewriteCond %{HTTP_HOST} !^www\. [NC]
      RewriteRule ^(.*) http://www.%{HTTP_HOST}$1 [R=301,L]
      DocumentRoot /var/www/html/datingjapan.co
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>and this is the .htacess</p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
      RewriteEngine on
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_FILENAME} !-l
      RewriteRule ^(.*)$ index.php?/$1 [L]
  &lt;/IfModule&gt;
  </code></pre>
  
  <p>I have been trying to add the .htaccess to the Virtual Host so I can remove the .htaccess file - below is an example, but I get the site to show:</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
      ServerName datingjapan.co
      ServerAlias *.datingjapan.co
      RewriteEngine on
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_FILENAME} !-l
      RewriteRule ^(.*)$ index.php?/$1
      RewriteCond %{HTTP_HOST} !^www\. [NC]
      RewriteRule ^(.*) http://www.%{HTTP_HOST}$1 [R=301,L]
      DocumentRoot /var/www/html/datingjapan.co
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>I understand the [L] means last rule to match so I have removed that but it still doesn't work.</p>
  
  <p>What am I missing here? I've tried reversing the rules.</p>
  
  <p>thankyou</p>