Skip to content

Instantly share code, notes, and snippets.

@daniloparrajr
Last active February 17, 2020 02:29
Show Gist options
  • Save daniloparrajr/4810e49dd2d74bfcf989ccb7264b0ca8 to your computer and use it in GitHub Desktop.
Save daniloparrajr/4810e49dd2d74bfcf989ccb7264b0ca8 to your computer and use it in GitHub Desktop.
Creating Virtual Host in XAMPP

Step 1

Open httpd.conf file present in C:\xampp\apache\conf\httpd.conf Remove the #(hash) sign present to include the “httpd-vhosts.conf” file in httpd.conf file.

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

To

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

Step 2

Create a virtualhost file. Open “httpd-vhosts.conf” file. And copy the below lines of code.

<VirtualHost *>
  # set path on your project folder
  DocumentRoot "C:/xampp/htdocs/_projects/projectname"
  ServerName projectname.local
  DirectoryIndex index.php
  <Directory "C:/xampp/htdocs/_projects/projectname">
    AllowOverride All
    Allow from All
  </Directory>
</VirtualHost>

Step3:

Open C:\Windows\System32\drivers\etc\hosts Add the below line at the end of file.

127.0.0.1      <SERVER_NAME like local.pos.com>

Restart apache server and visit the site URL. That’s all is needed to set up a virtual host.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment