How to make a virtual host in Xampp/Wamp server

Share on facebook
Facebook
Share on google
Google+
Share on twitter
Twitter
Share on linkedin
LinkedIn

Let’s see how virtualhost are created in Xampp, although this is very similar in any version of Apache.

Step 1. Enter the file C:\xampp\apache\conf\httpd.conf and add or uncomment the include of the virutal hosts file:

# Virtual hosts
Include conf/extra/httpd-vhosts.conf

Step 2. Enter the file C:\xampp\apache\conf\extra\httpd-vhosts.conf and add the virtualhosts, in my case I will create a virtualhosts, one for a new project created with laravel.

# LARAVEL PROJECT
<VirtualHost *:80>   
    DocumentRoot "C:/xampp/htdocs/laravel"
    ServerName laravelproject.com.devel
    ServerAlias www.laravelproject.com.devel
    <Directory "C:/xampp/htdocs/laravel">
        Options Indexes FollowSymLinks     
        AllowOverride All
        Order Deny,Allow
        Allow from all     
    </Directory> 
</VirtualHost>

Step 3. Add to the hosts file of our system, in the case of Windows C:\Windows\System32\drivers\etc\hosts , and add the IP and url.

127.0.0.1   laravelproject.com.devel

What we are telling you is that when we load any of those domains we call the IP that we indicate in this case 127.0.0.1 instead of the original IP of the domain if it has one.

Now if we go to http://laravelproject.com.devel we will open the web we have in our directory www

Laravel Project virtual host

More to explorer

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Sign up to receive our amazing newsletters and gifts