virtual hosts

Problems with the Windows version of XAMPP, questions, comments, and anything related.

virtual hosts

Postby azimut » 31. July 2018 12:43

Hi everyone,
I have problem with configuration virtual hosts. I have at the htdocs 2 folders - t and t2. I want to use url t.locahost and t2.locahost to open different projects. My httpd-vhosts.conf looks:
Code: Select all
NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot "c:/xampp/htdocs/t2"
ServerName t2.localhost
<Directory "c:/xampp/htdocs/t2">
</Directory>
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "c:/xampp/htdocs/t"
ServerName t.localhost
<Directory "c:/xampp/htdocs/t">
</Directory>
</VirtualHost>


and my host file looks:
Code: Select all
# localhost name resolution is handled within DNS itself.
#   127.0.0.1       test
#   ::1             localhost
#   127.0.0.1      test.locahost
   127.0.0.1      t.locahost
   127.0.0.1      t2.locahost

I commented documentroot at httpd.conf.
Can you help me with this issue? Xampp gives me only t2.locahost.
Thank you
azimut
 
Posts: 2
Joined: 31. July 2018 12:33
XAMPP version: 3.2.2
Operating System: windows 10

Re: virtual hosts

Postby Altrea » 31. July 2018 13:53

Remove the line NameVirtualHost *:80, this is no longer needed
Fix your host names in your hosts file. You are writing locahost instead of localhost
And don't comment the DocumentRoot in your httpd.conf. This is not needed.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11935
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: virtual hosts

Postby azimut » 31. July 2018 14:12

Hi, thank you for your advice. It was very helpful.
azimut
 
Posts: 2
Joined: 31. July 2018 12:33
XAMPP version: 3.2.2
Operating System: windows 10


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 140 guests