• Resolved gdaly

    (@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. example.com) 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. example.com 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. example.com 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. example.com to look at localhost (127.0.0.1). 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.
    192.168.1.1 https://www.example.com

    Thread Starter gdaly

    (@gdaly)

    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:
    192.168.0.4 https://www.example.com

    where 192.168.0.4 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.

    Cheers

    Thanks for reporting back with good information. As far as the hosts file under xp it’s in the same place.
    C:\windows\system32\drivers\etc\hosts

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