Copied!
PHP
how to create virtual host on XAMPP - in 3 simple steps
Shahroz Javed
Aug 05, 2023 . 97 views

Table Of Contents

Introduction

Creating a virtual host in XAMPP involves configuring your local development environment to recognize a custom domain name and route requests to a specific directory on your computer. This is useful for developing and testing web applications locally with a specific domain name. Here's how you can create a virtual host in XAMPP:

Steps

01: Edit the Hosts File:

127.0.0.1 myapp.local

02: Configure Apache Virtual Host:

<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs/myapp"
    ServerName myapp.local
    <Directory "C:\xampp\htdocs\myapp">
    </Directory>
</VirtualHost>
        

Replace "C:/xampp/htdocs/myapp" with the actual path to your project's directory.

03: Restart Apache:

04: Access Your Virtual Host:

Conclusion:

Your virtual host should now be accessible using the specified domain name (`myapp.local`) in your web browser. This allows you to work on your web application using a custom domain name in your local development environment.

13 Shares

Related Posts

Similar Posts