Virtual Hosts - always redirected to localhost/dashboard?

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

Virtual Hosts - always redirected to localhost/dashboard?

Postby bhuether » 24. September 2019 22:29

Hi,

I have set up virtual hosts seemingly correctly.

The httpd.conf file has these relevant lines

Code: Select all
#ServerName localhost:80
<Directory />
    AllowOverride none
    Require all denied
</Directory>

DocumentRoot "C:/xampp/htdocs"
<Directory "C:/xampp/htdocs">
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Require all granted
</Directory>

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


My vhosts file has

Code: Select all
NameVirtualHost *:80

<Directory C:/sites>
    AllowOverride All
    Require all granted
</Directory>

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot "C:/xampp/htdocs"
    ServerName localhost
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot "C:/sites/mysite/public"
    ServerName mysite.com
</VirtualHost>




And of course hosts file

Code: Select all
127.0.0.1 mysite.com


No matter what I do mysite.com gets redirected to localhost/dashboard. I have tried with and without NameVirtualHost. I have confirmed that httpd-vhosts.conf is used because if I make a typo apache won't start. And yes - I restart apache after any conf file change. And log files don't point to anything.

I can't imagine why this isn't working. All paths are valid. Everything seems correct. But no mater what, localhost/dashboard wants to assert itself...

Ideas?

Thanks
bhuether
 
Posts: 1
Joined: 24. September 2019 22:15
XAMPP version: v3.2.4
Operating System: windows 7

Re: Virtual Hosts - always redirected to localhost/dashboard

Postby Altrea » 25. September 2019 05:38

Hi,

maybe your webapplication itself or a .htaccess rewrite/redirect rule redirects to localhost?
You can check your Apache configuration and which vhosts are known by clicking the Shell Button in your XAMPP control panel and typing in
Code: Select all
httpd.exe -S


best wishes,
Altrea
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: 9861
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: Virtual Hosts - always redirected to localhost/dashboard

Postby Nobbie » 25. September 2019 11:26

Altrea wrote:maybe your webapplication itself or a .htaccess rewrite/redirect rule redirects to localhost?


+1

That was my very first idea...
Nobbie
 
Posts: 11219
Joined: 09. March 2008 13:04


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 44 guests