Page 1 of 1

Can't you own hosts data when offline

PostPosted: 27. January 2009 17:40
by evoman91
I have set domain names in hosts but when i'm not connected to the internet I can't get to any of the domains I set but I can still access the sites when I type 127.0.0.1 or localhost

Here is a copy of my hosts
# Copyright (c) 1993-2006 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host

127.0.0.1 localhost
::1 localhost
127.0.0.1 sjhopwell.com
127.0.0.1 sjhopwell.co.uk
127.0.0.1 www.sjhopwell.co.uk
127.0.0.1 http:\\www.sjhopwell.co.uk
127.0.0.1 www.sjhopwell.com
127.0.0.1 http:\\www.sjhopwell.com


Any help would be appreciated thanks

Re: Can't you own hosts data when offline

PostPosted: 27. January 2009 18:08
by Wiedmann
- What happens if you "ping" one of the not working hostnames?
- The error message from your browser?

BTW:
"http:\\" is not allowed in the HOSTS file.

Re: Can't you own hosts data when offline

PostPosted: 27. January 2009 18:13
by evoman91
ping just said request could not find host sjhopwell.co.uk, can still ping 127.0.0.1 etc.
my browsers just comes up with page load error, address not found, etc.

Re: Can't you own hosts data when offline

PostPosted: 27. January 2009 18:21
by Wiedmann
Code: Select all
127.0.0.1 sjhopwell.co.uk

ping just said request could not find host sjhopwell.co.uk

What happens with "nslookup sjhopwell.co.uk" (with and without internet connection)?

Re: Can't you own hosts data when offline

PostPosted: 27. January 2009 18:48
by evoman91
Image

1st is with internet connection
2nd is without

Re: Can't you own hosts data when offline

PostPosted: 27. January 2009 19:08
by Wiedmann
- Can you make the same (a second time) with "ping sjhopwell.co.uk" (on/offline)?
- You are connected through a router or a modem with the internet?
- If a modem, did you have a networkcard in your pc?

Re: Can't you own hosts data when offline

PostPosted: 27. January 2009 19:12
by evoman91
Image
1st is with internet connection
2nd is without

I'm connected through a router

Thanks for the help so far :D

Re: Can't you own hosts data when offline

PostPosted: 27. January 2009 21:04
by Wiedmann
I'm connected through a router

So when you are not connected to the internet, your router is not connected. But your pc is still connected to the router (and the router is on).

Re: Can't you own hosts data when offline

PostPosted: 27. January 2009 21:07
by evoman91
No i'm connected though wireless so I just turn off my wireless

Re: Can't you own hosts data when offline

PostPosted: 27. January 2009 21:22
by Wiedmann
so I just turn off my wireless

I guess that's the problem.

You can try to install the Microsoft Loopback adapter.

Re: Can't you own hosts data when offline

PostPosted: 27. January 2009 22:29
by evoman91
Nope that hasn't worked :(

Re: Can't you own hosts data when offline

PostPosted: 28. January 2009 00:51
by dmphotography
Well first off, you do not have to put the http:// in your host file. I don't know, but this could be causing the conflict. And this only works on the computer you have XAMPP installed on, not the other computers in your network if that's what you're trying to do.

Whether or not you're connected to the internet shouldn't matter. I can enter www.google.com in my host file and when I go to www.google.com on that computer, it will go to whatever I've defined it to go to in my vhosts file, as this will override any external requests for that domain.

Also verify that you are accessing the correct file. C:/Windows/system32/drivers/host . I know that seems dumb, but sometimes not being in the correct file can be the source of many headaches.

This should work to my knowledge if you've removed the "http://" from your file.

Re: Can't you own hosts data when offline

PostPosted: 28. January 2009 08:13
by evoman91
I've removed the http:// and made sure its the correct hosts, I'll try writing it more clearly, when connected tot the internet net I can go to sjhopwell.co.uk which its technically 127.0.0.1 but when not connected I can't use sjhopwell.co.uk but can still use 127.0.0.1

Re: Can't you own hosts data when offline

PostPosted: 28. January 2009 08:32
by Izzy
Is Apache configured to serve a web site at sjhopwell.co.uk address on your PC when not connected to the net?

What do you see when you type http://127.0.0.1 or http://localhost

Or do have another sever configured to serve the web sites at all the addresses you have in your hosts file on your PC?

Try commenting out this line in the HOSTS file
::1 localhost
to
# ::1 Localhost