Cannot ping or view local websites.

nockieboy 1 Reputation point
2022-11-28T13:31:53.653+00:00

Hi,

I've been developing some websites locally on my computer for ages now, they used to run fine through XAMPP and I could view them in the web browser by going to their 'local dev' URL, which is specified in the vhosts.conf for XAMPP and also in Windows' hosts file (which directs to 127.0.0.1).

Problem is, I've tried to access those sites again and they're not working now. I have no idea what has changed since I last tried a month ago, but they're not working. I seem to have narrowed the problem down to local host resolution, as I can ping localhost and get results back, but if I try to ping any other 'local website' on my computer, I get this from ping:

Ping request could not find host me. Please check the name and try again.

I've used 'me' in the above example, but the response is the same for all local websites I have set up.

Ping works for localhost though:

PS C:\Users\xxxx> ping localhost  
  
Pinging xxxxx [::1] with 32 bytes of data:  
Reply from ::1: time<1ms  
Reply from ::1: time<1ms  
Reply from ::1: time<1ms  
Reply from ::1: time<1ms  
  
Ping statistics for ::1:  
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),  
Approximate round trip times in milli-seconds:  
    Minimum = 0ms, Maximum = 0ms, Average = 0ms  

I've checked the hosts file using PowerToys Hosts File Editor and it's showing all the addresses are set up correctly. I have XAMPP running, there are no conflicts on port 80 that Apache is using. I have turned off my firewall just in case.

Interestingly, I'm able to view myPhpAdmin in the browser, so that's working.

I can't think what might have changed to cause this problem, but it's infuriating me and I've lost a day of work because of it already. Does anyone have any ideas?

Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
8,864 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Gabriel Dispemec 431 Reputation points
    2022-11-29T12:08:45.68+00:00

    Are you getting access (browser) with 127.0.0.1 or via localhost?

    Have you tried looking at the Apache error logs?

    0 comments No comments

  2. nockieboy 1 Reputation point
    2022-11-29T12:31:06.49+00:00

    There were no errors in the Apache logs. I narrowed it down to an issue with the hosts file itself. In the end, I deleted the hosts file and created a new one and the problem was instantly solved.

    I have no idea why, though. I was editing hosts using the PowerToys tool, so the format should have been fine. Maybe there was a permissions issue? I'll probably never know.

    0 comments No comments