0

So, I host my WordPress website on my PC. 192.168.1.5:25566 (port forward). On my LAN, I can access homepage and other pages on the site. But from outside the LAN, I can access homepage but cannot access other pages on the site. I suspect this is due to the links to the other page being 192.168.1.5:25566/page2, as 192.168.1.5:25566 is set in Settings>General.

So, I put my WordPress site address in Settings>General to 80.90.484.594(my public IP, not my real public IP cuz I ain't giving that out). After I do this, WordPress site and all it's pages can be accessed from outside the LAN but not inside the LAN. I thought I set my Apache server to listen to 192.168.1.5:25566 but somehow WordPress, which AFAIK runs on Apache, cannot be accessed from my LAN. Is there a way to access all pages from the outside network as well as inside?

0

I would say your best bet would be too keep your wordpress with the external IP and edit your hosts file inside the lan so your internal IP resolves to the external. I don't see a way of having 2 different urls for a single WP install.

| improve this answer | |
  • You didn't mention if you have a domain name pointing to your public IP. If you don't you can get a dynamic dns style domain for free from various providers (yourdomain.hopto.org for example). Then edit your hosts file to point the domain toward your internal ip and the domain to your public IP. That should sort it out. Make sure apache is configured to serve the domain as a virtualhost too. This isn't a wordpress issue, it is a networking / server issue. – Admiral Noisy Bottom Apr 19 at 1:46
  • @AdmiralNoisyBottom I don't get it. AFAIK, Apache and WP don't know my public IP address as they are within my NAT. Does Apache and WP know my external address? – lpydawa Apr 19 at 3:11
  • @lpydawa Apache doesn't need to know your public IP. It binds to your local address and serves pages to what ever address wants them. As far as I know a virtualhost has to have a name rather than an IP address. If you tell WP your site url is 192.168.1.5 then when it is accessed from the internet, it wont work because 192.168.0.1.5 is not accessible by the outside world. By having a dynamic domain name you have consistency. WP has proper url, apache answers with a proper name and both accessible from outside. Hope that makes some sense. It's hard to explain. – Admiral Noisy Bottom Apr 20 at 2:26
  • @lpydawa another option would be tell WP it's url is your public ip and you should be able to access internally via public_ip:25566 and externally if you don't want a dynamic domain name. – Admiral Noisy Bottom Apr 20 at 2:35
  • @AdmiralNoisyBottom yep, I set Settings >General>Site IRL and WP URL to my public IP address and it works. This way I can access from outside and inside my network. However, when accessing from inside the network, WP only serves bare HTML with no CSS. I'm guessing that's because WP software somehow has some idea of my public IP, and only serves HTML to that IP. WP networking is more complicated than I thought. – lpydawa Apr 20 at 3:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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