• Running a local WordPress site on a Windows host, behind a NAT router that doesn’t support NAT loopback.

    I can get to the site internally, I can get to the Admin pages externally using the internet facing IP address (haven’t moved my domain redirect yet). When I try access the site externally, it’s trying to load from the internal IP address.

    I have these 2 lines in my wp-config.php file that’s in my root WP.
    define(‘WP_HOME’, ‘https://’ . $_SERVER[‘HTTP_HOST’]);
    define(‘WP_SITEURL’, ‘https://’ . $_SERVER[‘HTTP_HOST’]);

    Don’t know if this has anything to do with it but I used Duplicator to move my site from Azure to my localhost

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @gerryh,

    Wow, that’s a great question.

    I’m sure there are more sophisticated ways to accomplish what you’re trying to do but my first inclination is that you’re having trouble because, despite your wp-config.php settings, you’ll have URLs throughout your database that aren’t using the $_SERVER[‘HTTP_HOST’] entries; they’ll be using your local IP or whatever URL you used when you restored your site.

    So, I’m guessing that you’re able to get to the backend alright because it’s loading all URLs based upon your wp-config.php definitions, but when you load a front-end page, it’s trying to load assets over your local IP, which won’t work.

    I’d be inclined to skirt this issue by using a domain that you can access from an external source, rather than using your IP.

    There are DNS services like NoIP or DynDNS that allow you to use a domain and map it to your local machine or router. If you were to do that, you could either use a TLD of your own (if you pay for it) or one of their domains and route it to your local machine.

    Then, within your WP database, you’d search/replace your old URLs (I think they’re IPs) to your new domain, which you should be able to access both in and outside of your network.

    Does that make sense and help at all? I hope so.

    Eric

    Thread Starter gerryh

    (@gerryh)

    Yes, it seems there’s no good or easy way to administer a WP site with both an external domain name and an internal IP address. After tons of hours, I’m a lot more intimate on how WP works and the tables in MySQL. But ultimately I decided to move it back to an external hosting provider.

    You can use the same domain name both internal and external.
    The external is already done.
    For internal you need the web server to have a fixed IP, most routers have the ability to permanently assign an IP address to a MAC (say it is 192.168.0.33). Then in each computer on the internal network that needs to access your WordPress site, you add this to their “hosts” file
    details on precise location here: https://en.wikipedia.org/wiki/Hosts_(file)
    The line is like:
    192.168.0.33 yourdomain.com

    Just another option.

    • This reply was modified 6 years, 7 months ago by RossMitchell.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Site not externally accessable’ is closed to new replies.