I want to create a virtual host for my Laravel project with XAMPP, so I have followed these steps:
Step 1) C:\WINDOWS\system32\drivers\etc\
Opened the "hosts" file (as Administrator):
127.0.0.1 test.com
Step 2) xampp\apache\conf\extra\httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/freedeliveries/public"
SetEnv APPLICATION_ENV "development"
<Directory "C:/xampp/htdocs/freedeliveries/public">
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ServerName www.test.com
</VirtualHost>
Step 3) C:\xampp\apache\conf\httpd.conf
. Scrolled down to the Supplemental configuration section at the end, and located the following section (around line 500), Removed the #
from the beginning of the second line so the section now looks like this:
#Virtual hosts
Include conf/extra/httpd-vhosts.conf
Step 4) Restarted XAMPP and now run this in my browser :
www.test.com
But now I get this as result:
ERROR The requested URL could not be retrieved
The following error was encountered while trying to retrieve the URL: http://test.com/
Unable to determine IP address from hostname test.com
The DNS server returned:
Name Error: The domain name does not exist.
This means that the cache was not able to resolve the hostname presented in the URL. Check if the address is correct.
Your cache administrator is root.
So how to solve this and ran the Laravel project on a virtual hostname?
UPDATE: