Search This Blog

Saturday, October 29, 2011

How to create virtual host In XAMPP in windows

1.Create a folder in C:\xampp\htdocs\mysite
2. Edit your hosts file in windows  located in C:\WINDOWS\system32\drivers\etc\ and add following line
127.0.0.1 mysite.localhost
Don’t delete the existing “127.0.0.1 localhost” line
3.Open your C:\xampp\apache\conf\extra\httpd-vhosts.conf file and add the following lines

NameVirtualHost *:80
<VirtualHost *:80>
    DocumentRoot "C:\xampp\htdocs"
    ServerName localhost
</VirtualHost>


<VirtualHost *:80>
    ServerName mysite.localhost
    DocumentRoot C:\xampp\htdocs\mysite
    <DirectoryC:\xampp\htdocs\mysite>
        DirectoryIndex index.php
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>
4. Reboot your computer .You should now be able to access each dev domain by way of:
http://mysite.localhost/

No comments: