Unable to redirectly properly using Name Virtual Host

Discussion in 'Apache' started by aditi_19, Aug 17, 2010.

  1. #1
    Hi,

    I have three different sites with the same IP address using Name Virtual Host. My conf settings in httpd.conf redirects first two sites properly. But for the third Virtual Host block, it always redirects to the first address.

    Please let me know if I am missing any settings. I have tried it a lot but www.code3.com always opens up the index page of www.code1.com.

    
    NameVirtualHost 74.188.20.115
    
    <VirtualHost 74.188.20.115>
       DocumentRoot "C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\Code1"
       ServerName www.code1.com
    	DirectoryIndex Index.php
    </VirtualHost>
    
    <VirtualHost 74.188.20.115>
       DocumentRoot "C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\Code2"
       ServerName www.code2.com
       ServerAlias code2.com
    DirectoryIndex index.php
    </VirtualHost>
    
    <VirtualHost 74.188.20.115>
       DocumentRoot "C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\Code3"
       ServerName www.Code3.com
       ServerAlias Code3.com 
     DirectoryIndex index.php
    </VirtualHost>
    
    Code (markup):
    Any help will be highly appreciated. Thanks
     
    aditi_19, Aug 17, 2010 IP