How to check why virtual hosts don't work

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

How to check why virtual hosts don't work

Postby fuzmic » 11. May 2021 08:17

Hi members

I have create a few virtual hosts before in my localhost using xampp for windows. There is no problem with these older entries.
As advised, to achieve this i place 1) entries in hosts of system32/drivers/etc eg 127.0.0.1 mysite.local 2) entries in httpd-vhosts.conf of c:\xampp\apache\conf\extra between <VirtualHost *:80> & </VirtualHost>.

But when i browse eg http://mysite.local (after restarting apache) it always end up in https://mysite.local/dashboard/

Question: how can i find out what went wrong. I have double check all entries, they are similar to what i have done before that work. Appreciate your pointers. :mrgreen:
fuzmic
 
Posts: 23
Joined: 03. May 2020 12:17
XAMPP version: 7.2.30
Operating System: win 10

Re: How to check why virtual hosts don't work

Postby Altrea » 11. May 2021 10:02

  • Define access and error log files for each specific vhost. If you request a vhost, you can check in the log entries if the vhost has matched / entries are added
    Code: Select all
        ErrorLog "logs/vhostname-error.log"
        CustomLog "logs/vhostname-access.log" common
  • Define
    Code: Select all
        LogLevel notice rewrite:trace5
    in each of your vhosts to also include rewrite messages in the log
  • xampp shell command
    Code: Select all
    httpd -S
    will output all defined and active vhosts
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: 10972
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: How to check why virtual hosts don't work

Postby Nobbie » 11. May 2021 10:26

Did you activate include httpd-vhosts.conf in httpd.conf? Most people overlooked that it is commented out via # in first column.
Nobbie
 
Posts: 12067
Joined: 09. March 2008 13:04

Re: How to check why virtual hosts don't work

Postby fuzmic » 13. May 2021 07:31

Thanks guys for the response.

I found out why: it is because of the cache of the browser which already recognize mysite.local. Once the cache is cleared it works.
fuzmic
 
Posts: 23
Joined: 03. May 2020 12:17
XAMPP version: 7.2.30
Operating System: win 10


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 95 guests