skip to Main Content

Virtual host is most beneficial to run project with good url like:
http://example.test/ how to make it in xampp ?

2

Answers


  1. Open hosts file. On Windows, it’s usually located at C:WindowsSystem32driversetchosts, while on macOS and Linux, it’s found at /etc/hosts.
    Add a New Entry: 127.0.0.1 yourlaravelapp.test

    Add a Virtual Host Configuration:
    Windows, it’s usually located at C:xamppapacheconfextrahttpd-vhosts.conf. On macOS, it’s typically located at /Applications/XAMPP/etc/extra/httpd-vhosts.conf.

    <VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs/your-laravel-project/public"
    ServerName yourlaravelapp.test
    ServerAlias www.yourlaravelapp.test
    </VirtualHost>
    

    And after that restart apache

    Login or Signup to reply.
  2. First, open your hosts file,

    • Window -> C:WindowsSystem64driversetchosts
    • Linux/macOS ->
      etchosts

    Add below line in hosts file,

    127.0.0.1    yourvirtualhost.name
    

    Configure your Apache in httpd-vhosts.conf,

    <VirtualHost *:8000>
        DocumentRoot "C:/xampp/htdocs/yourproject"
        ServerName yourvirtualhost.name
    </VirtualHost>
    

    And then restart your xampp, now you can access using yourvirtualhost.name.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search