Can't you own hosts data when offline

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

Can't you own hosts data when offline

Postby evoman91 » 27. January 2009 17:40

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
evoman91
 
Posts: 7
Joined: 27. January 2009 17:29

Re: Can't you own hosts data when offline

Postby Wiedmann » 27. January 2009 18:08

- 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.
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: Can't you own hosts data when offline

Postby evoman91 » 27. January 2009 18:13

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.
evoman91
 
Posts: 7
Joined: 27. January 2009 17:29

Re: Can't you own hosts data when offline

Postby Wiedmann » 27. January 2009 18:21

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)?
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: Can't you own hosts data when offline

Postby evoman91 » 27. January 2009 18:48

Image

1st is with internet connection
2nd is without
evoman91
 
Posts: 7
Joined: 27. January 2009 17:29

Re: Can't you own hosts data when offline

Postby Wiedmann » 27. January 2009 19:08

- 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?
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: Can't you own hosts data when offline

Postby evoman91 » 27. January 2009 19:12

Image
1st is with internet connection
2nd is without

I'm connected through a router

Thanks for the help so far :D
evoman91
 
Posts: 7
Joined: 27. January 2009 17:29

Re: Can't you own hosts data when offline

Postby Wiedmann » 27. January 2009 21:04

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).
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: Can't you own hosts data when offline

Postby evoman91 » 27. January 2009 21:07

No i'm connected though wireless so I just turn off my wireless
evoman91
 
Posts: 7
Joined: 27. January 2009 17:29

Re: Can't you own hosts data when offline

Postby Wiedmann » 27. January 2009 21:22

so I just turn off my wireless

I guess that's the problem.

You can try to install the Microsoft Loopback adapter.
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: Can't you own hosts data when offline

Postby evoman91 » 27. January 2009 22:29

Nope that hasn't worked :(
evoman91
 
Posts: 7
Joined: 27. January 2009 17:29

Re: Can't you own hosts data when offline

Postby dmphotography » 28. January 2009 00:51

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.
For great video and written tutorials and guides on creating your own web server and installing things such as forums, blogs, etc., visit http://myownhomeserver.com
dmphotography
 
Posts: 191
Joined: 15. December 2008 14:25
Location: Columbus, MS
Operating System: Windows 7

Re: Can't you own hosts data when offline

Postby evoman91 » 28. January 2009 08:13

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
evoman91
 
Posts: 7
Joined: 27. January 2009 17:29

Re: Can't you own hosts data when offline

Postby Izzy » 28. January 2009 08:32

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
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 44 guests