Support » Installing WordPress » localhost vs WAN

  • Resolved gdaly


    Hi all, WP noob here.

    I have set up WP under Apache, on my own machine, which is behind my static IP ADSL router/firewall. I have a registered domain name (lets say www. which points to the static IP.

    The router/firewall port-forwards all the necessary web ports to my computer (the apache server) and blocks everything else.

    So when I set the server name as www. under WordPress options, everything works fine PROVIDED you are accessing the site from outside the firewall.

    When I try to access the site from my computer though, it tries to access the router admin page because it thinks www. is the router. When the router is accessed from the LAN the portforwarding doesn’t happen, and it tries to serve the pages itself using it’s web-admin system

    On the other hand, I can set the hostname in WP options to localhost, so it then works fine when I access it from my machine, but it doesn’t work for WAN clients. The external users links all point to localhost, which is their local machine, wherever they are.

    This is more a networking problem than WP, but I think that the problem could be solved if I could tell my machine (and only my machine) that whenever it sees www. to look at localhost ( The Windows “route” command looks promising, but I’m no expert so I need some advice there.

    Can anyone help?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Just create host file on whatever machine your accessing the blog with point to the server’s ip address and domain name.

    For ex.

    Fantastic, Thanks Jeremy. Too easy and I’ve been struggling with this for ages. lol

    For the other bewildered out there, there is a “hosts” file (with no filename extension) found under C:\Windows\System32\drivers\etc\ with Vista (and maybe XP, I don’t know)

    You may need to run notepad as Administrator if you get messages that you can’t save the file.

    Add a line as Jeremy suggested:

    where is the ip address of the server computer in your LAN. If you’re not sure what this is, you can go to Control Panel > Network and Sharing Center, then click the “view full map” link at the top-right of the page. If you hover over each component of your network you can see the IP addresses.

    Add a line for each server name “www….” you’re having problems with.


    Thanks for reporting back with good information. As far as the hosts file under xp it’s in the same place.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘localhost vs WAN’ is closed to new replies.