I have setup a small website using LAMP (Raspbian) and Wordpress.
No domain name will be registered for the website.
For the moment I am accessing the site from inside the local network.
To access the site I just hit the IP address of the server (internal).
I want to access the site from outside the local network via the public IP.
The public IP is static and a Firewall is configured to translate the internal IP/default port(80) to the public static IP/(random port) and vice versa. Internal IP is static also and the RPi is directly connected to the FW via cable.

If I send a request from an external IP the page never loads and inside my admin panel(via WP Statistics plugin) I can see the request.

I would like to note that I have modified the wp-config.php and specifically these lines:



What changes do I need to make so that the site will respond to the external requests?

Is there anything I should check in my Wordpress/Apache/mySql/Linux configuration?

Please let me know if any configuration info would be useful.

  • Not all IP address are routeable. There are private IP addresses that are not routable; only used internally. If your company has a VPN client, usually that will allow you to access internal IP addresses
    – user42826
    Jul 20, 2017 at 15:36
  • @user42826 To my knowledge the network settings are correct. A separate company is responsible for the IT infrastructure and the Firewall. Furthermore, the settings were verified also by the Firewall manufacturer. From a brief network testing, I was told that Wordpress(or Linux/Apache do not know exactly) does a redirection to its own IP address and does not respond back to the external IP address. Since I am new to Wordpress I want to find out if such behavior could be the result of some of the settings and how I can modify the site to be accessible only from the outside.
    – vkoukou
    Jul 20, 2017 at 16:25
  • Can you ping the IP address? Can you connect to IPaddress:port 80? Take WP out of the loop. (From outside) Try to access a static html page, e.g. ipaddress/readme.html
    – user42826
    Jul 20, 2017 at 16:46
  • @user42826 Thanks for the answers. IP is not pingable (most probably due to security). But I can access ipaddress/readme.html and other static content from the webserver without a problem. In case I put index.php by hand in the browser I get redirected to the login URL (I have used Theme My Login plugin to only allow logged in users in the site), all I see is static content. This does indeed support the assumption that network is fine and Wordpress has some issue. Any suggestions what might cause this behavior?
    – vkoukou
    Jul 20, 2017 at 17:17
  • I understand your situation better now and posted an answer. Note that there are other work-arounds too for your situation.
    – user42826
    Jul 20, 2017 at 17:44

2 Answers 2


When installing WP onto an IP address (or hostname), WP will only respond to requests on that IP address. Any request from another IP address even if it resolves to the same server, will result in a redirect to a WP error page.

In this situation, I would do this:

  1. Install WP on the public IP address. This will work if you can route to the public IP address internally.
  2. f you cannot route to the public IP address internally then I suggest installing on a hostname. You need to configure your DNS so that internally it will resolve to the internal IP address; and externally it will resolve to the public IP address.
  • For 1 you mean re-install WP? Or changing the 2 define lines in wp-config.php would be sufficient? For 2 you mean the internal network's DNS? e.g. configure dns on the FW/router or change the hosts in linux to resolve to the public address? Any additional info/links would be highly appreciated. (please note I will test this tomorrow at the office) thus feedback and/or marking the answer correct might take a while. Thanks for the help so far!
    – vkoukou
    Jul 20, 2017 at 18:27
  • The (private) IP address that you installed with is in the database. Either re-install WP if it is new and you dont mind losing your work. Or you could do a search and replace in your database. Additionally you would need to update the IP address in wp-config.php.
    – user42826
    Jul 20, 2017 at 18:55
  • I will try replacing it in the database with backup/modify/replace offline and then upload the new files to the server plus changing both home and site url to the public IP in wp-config.php thanks for all the help. I will come back and verify if this worked or not.
    – vkoukou
    Jul 20, 2017 at 19:00
  • Public IP access is working! I used the relocate method from this post and changed also the config file. Now Wordpress does not serve requests from behind the firewall (is there a way to do this? either via the network or the apache? maybe this should be another topic). Thanks for the help!
    – vkoukou
    Jul 20, 2017 at 21:00

While it isn’t quite considered to be intended mode of operation WP_HOME and WP_SITEURL can be declared dynamically conditional on individual request, rather than hardcoded.

There is very little state in PHP natively, so if you tell it to handle specific request as if responding to this or that hostname/IP — it will.

Of course while this will make WordPress core boot, there is some state on its side of things such as URLs captured in content and so on.

In a nutshell this is certainly possible, but practicality of it depends a lot on specifics of the site.

Not the answer you're looking for? Browse other questions tagged or ask your own question.