Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Getting localhost to work when off-line

so I can develop when not connected

5:15 pm on Jul 3, 2008 (gmt 0)

Junior Member

10+ Year Member

joined:May 13, 2003
posts: 151
votes: 0


This may not be the right place to post this, but it seemed the most relevant forum.

I have apache/php/mysql running on my laptop, and use it to code locally before uploading to the server.

I've edited my hosts file on Windows, so that I can connect to apache via [local.example.com...]

This works fine when I am connected to the web, but does not when I am offline! I've been frustrated by a dodgy net connection recently, and it's even more frustrating that I can't even make the most of working off-line.

Does anyone have any tips to get localhost working when off-line?

7:39 pm on July 3, 2008 (gmt 0)

Junior Member

10+ Year Member

joined:Oct 15, 2005
posts: 79
votes: 0

My guess is that you inadvertently set it up so that it sends the request out to the internet and your router is routing it back to your laptop.

In your httpd.conf file the listen parameter should be set to and then in your hosts file you should have entered local.example.com

and that should be it.


8:56 pm on July 3, 2008 (gmt 0)

Junior Member

10+ Year Member

joined:May 13, 2003
votes: 0

Thanks for the reply William.

I've got this in my httpd.conf:

Listen 3000


ServerName localhost
DocumentRoot "D:/apachedocs/"

And this in my hosts file: localhost

Apart from the "listen" directive, it was all there before. Adding the listen directive (which I may not have done correctly) doesn't seem to have helped :-(

I've tried it with my firewall on and off, no effect.

Any other clues?

6:45 pm on July 5, 2008 (gmt 0)

Preferred Member

10+ Year Member

joined:Jan 4, 2005
votes: 0

Check you tools -> options settings in your browsers if you are using IE.

IN your tools->internet options->connections - make sure "never dial a connection" is selected.

That sorted the same thing out for me in the past.

Good luck!