Support » Installing WordPress » Cannot access WordPress from localhost or other PC’s on LAN

  • I have an Actiontec GT701-wg router that is preventing access to my WordPress page from any PC on the LAN

    Here’s the scenario: I am using computer A to access and use my WordPress site, computer B is the server that is hosting the WordPress site, and both computers are plugged into a GT701 router, which in turn is linked to the Internet. Internet users can access the server from the outside by typing in (because port forwarding is set up on the GT701). However, the GT701 will not allow me to type that address in from computer A, because the GT701 interprets such an action as a request to view the GT701’a administrative interface. Instead, I must type in the local network IP address ( of computer B to access and use my WordPress site.

    However, this causes a problem because the “home” url is used by WordPress to create all the site’s links. If the “home” url is set for, I will be unable to use the site from computer A (even if I type in the local IP). If the “home” url is set for the local network IP address, Internet users will not be able to use the site.

    So, in order to add content, I have to go into the database, and change the value of the “home” field in the wp_1options table from to Once that is done, I can add my content, but nobody on the Internet can see my blog until I change the value of “home” back to


Viewing 5 replies - 1 through 5 (of 5 total)
  • I have encountered the same behavior while using Linksys routing devices on a couple if different networks. My Netgear routers, on the other hand, don’t seem to care if you are inside the network or not. I think you might be able to circumvent the issue by adding your wordpress URL
    ( ) to the hosts file (on the server). That way, when you type your blog address in the browsers address bar, it will allow the browser (on the server only, I believe) to resolve to I know it’s kind of strange to work on your blog from the server, but it’s a work around that might allow you to work from inside your network until you find a suitable solution. I hope I explained that correctly.

    I tried the hosts workaround, and no matter what I try, WordPress wants to insert it’s address in the browser. I did some digging around, and I found someone who had the same issue with Drupal, and they were able to modify the php code in one of the files as follows:

    In other words, base_url has to be different for internal network users and Internet users. To do this, replace the line $base_url = “”; with the following PHP code:

        $ipaddress = getenv(REMOTE_ADDR);
        $local= strpos($ipaddress, '192.168.');
           if ( $local=== false ) {
              $base_url = "";
           } else {
              $base_url = "local network IP address";

    I understand what they are doing, but I am not sure if the same thing can be done with WordPress or not. And if so, which file(s) would I need to modify?

    I just verified the hosts file method on one of my (Linux) servers. I accessed the blog from the servers browser, no problem. The browser address bar did indeed reflect the “http://” with the full blog address, but it resolved to I know it did, because I unplugged the network cable. I added one line to hosts: “” (without quotes of course).

    I would assume that it should work on a Windows server as well. Perhaps two entries to be safe: “” “”

    I’m afraid I’m totally lost when it comes to the php method you refer to.

    Best of luck to you.

    Ahh. I got it working now – had to have the www in order for it to work. I am still hoping someone else is able to figure out the php code solution. Thanks for the help.

    Glad to help…

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Cannot access WordPress from localhost or other PC’s on LAN’ is closed to new replies.