apache 2.4 name based virtualhost not working
<p>I am using Amazon Ec2 and i have consolidated the 2 sites and need to setup different redirect rules for my old sites. but when i tried to the same with the below configuration, the web server always takes the first virtual host entry (site1.com) and not taking the second virtual host entry ( site2.com). 
Can you check whether i am missing anything.</p>

<p>Please see below my config.</p>

<p>httpd.conf :</p>

<pre><code>Listen 0.0.0.0:80
Listen 0.0.0.0:443
Include conf/extra/httpd-vhosts-all.conf
</code></pre>

<p>httpd-vhosts-all.conf :</p>

<pre><code>&lt;VirtualHost *:80&gt;
ServerName site1.com
ServerAlias site1.com 
DocumentRoot "/websites/site1"  
&lt;Directory /websites/site1 &gt; 
Require all granted
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
   &lt;/Directory&gt;    
RewriteEngine On
RewriteRule     ^/page1$    page2.html
&lt;/VirtualHost&gt;
&lt;VirtualHost *:80&gt;
 ServerName site2.com 
 ServerAlias site2.com    
 DocumentRoot "/websites/site2" 
 &lt;Directory /websites/site2 &gt; 
   Require all granted
      Options Indexes FollowSymLinks Includes ExecCGI
     AllowOverride All
 &lt;/Directory&gt; 
 RewriteEngine On
 RewriteRule     ^/page3$   page4.html
 &lt;/VirtualHost&gt;
</code></pre>

<p>Thanks
Siva</p>