Why doesn't my localhost website load correctly on other devices?

Viewed 1812

I am developing a WordPress site in a locally hosted server via MAMP.

When I access the website from a different device (by connecting to the same Wi-Fi and entering the IP address as the URL), it loads as a plain HTML. For some reason, it cannot read the stylesheet. I tried this on multiple devices (Windows PC, iOS, and Android).

Any guidance on what the problem might be is greatly appreciated. Thank you.

UPDATE: Thanks to Kevin B's comment, I think I have an idea on what causes the problem. Looking at the console, it appears that the website is trying to load the assets from http://localhost/... which is something it cannot read (it considers localhost as a server run on the same device). The assets' href should be something along http://192.168.1.X for them to be obtainable. I still need to figure out how to fix this issue, but many thanks for putting me on the right track. Much Appreciated.

2 Answers
Related