How to setup virtual host on XAMPP for Magento 2 local development

  • March 13, 2023
No Comments

Magento 2 On Localhost , In this tutorials i am going to show you how to setup virtual hosts for Magento 2 websites with XAMPP running on windows

There are 3 steps to setup Magento 2 on localhost you have to follow

1.) Add vitual host configuration in D:\xampp\apache\conf\extra\httpd-vhosts file . location of file depends on where you have installed xampp .

open httpd-vhosts file , add below code and replace yourdomainname and project directory with yours.finally save the file.

<VirtualHost *:80>
      ServerAdmin youremail@yourdomainname.com
      DocumentRoot "D:/xampp/htdocs/Projectname/pub"
      ServerName yourdomainname.com
      ServerAlias www.yourdomainname.com
    ##ErrorLog "logs/dummy-host.example.com-error.log"
    ##CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>

2.) In this step you have to add the yourdomain name in hosts file located at C:\Windows\System32\drivers\etc\hosts .
open file in editor with Administrative Privileges , add below line and save it.

127.0.0.1  yourdomainname.com

3.) Please restart apache using XAMPP control panel and update the base url in core_config_data table to your new setup vitualhost.

For More Information Contact To Magento Services

About us and this blog

We are a digital magento 2  development agency with a focus on helping our customers achieve great results across several key areas.

More From Our Blogs

See all posts

Leave a Comment