Fixing Broken Local WordPress Sites on Your Network
Content
If you've set up a WordPress site on your local machine using XAMPP, MAMP, or another local server stack, you might run into a common but frustrating issue: the site looks perfect on the host computer but appears completely broken when accessed from another device on the same network. Images are missing, CSS styling is gone, and the layout is a mess. This guide will explain why this happens and walk you through the most reliable solutions.
Why Does This Happen?
The root cause is almost always the WordPress Address and Site Address settings. When you first install WordPress on a local server like XAMPP, it typically configures these addresses to use localhost or 127.0.0.1. These addresses are internal references that only point back to the computer itself.
When you visit the site from another computer on your Local Area Network (LAN), that computer's browser is told by WordPress to load crucial assets (like themes, images, and stylesheets) from localhost. Since localhost on that other computer points to itself and not your server, it fails to find these files, resulting in a broken, unstyled page.
How to Fix It: The Standard Solution
The most effective and common fix is to change the WordPress Address and Site Address to use the local IP address of the computer hosting the server.
- Find Your Server's Local IP Address: On the computer running XAMPP/MAMP, open a command prompt or terminal and type
ipconfig(Windows) orifconfig(Mac/Linux). Look for the IPv4 Address (e.g.,192.168.1.20). - Access Your WordPress Database: Open phpMyAdmin from your local server dashboard (e.g., XAMPP control panel).
- Update the Settings: Find your WordPress database and look for the
wp_optionstable (the prefix may be different if you changed it during installation). In this table, locate thesiteurlandhomerows. Change their values fromhttp://localhosttohttp://YOUR-IP-ADDRESS(e.g.,http://192.168.1.20). - Save and Test: Save the changes. You should now be able to access your site from another computer on the network by navigating to
http://YOUR-IP-ADDRESSin a web browser.
Alternative Method: Using the Hosts File
If you prefer to use a custom domain name like mysite.local on your network, you can edit the hosts file on every computer that needs access. This method is more advanced and requires configuration on each client machine.
- On the server computer, still change the
siteurlandhomevalues in the database to your custom name (e.g.,http://mysite.local). - On each computer that will access the site, you need to edit the
hostsfile. Its location is typically:- Windows:
C:WindowsSystem32driversetchosts - Mac/Linux:
/etc/hosts
- Windows:
- Add a new line to the file:
SERVER-IP-ADDRESS mysite.local(e.g.,192.168.1.20 mysite.local). Save the file. - You can now access the site on those computers by going to
http://mysite.local.
Important Considerations and Warnings
- Static IP: For either solution to work long-term, your server computer should have a static IP address on your local network. Otherwise, if its IP address changes (which can happen with DHCP), the links will break again. You can usually set a static IP in your computer's network settings or your router's administration panel.
- Security Warning: Exposing a local server to the internet is a significant security risk. The advice in this article is strictly for making a site accessible on a private internal network (intranet). The 'Localhost Installs' team and many community members strongly advise against port forwarding your home router to make a local WordPress site public, as it can expose your entire local network to threats.
- Plugin Limitations: Some plugins, like Jetpack, are designed for public websites and will not work on a local or private IP address. You may see errors such as "Your site host is on a private network."
By following these steps, you should be able to share your local WordPress development site with other devices on your network for testing and collaboration.
Related Support Threads Support
-
ERROR:LOCALHOST SITE DOES NOT DISPLAY IT’S CONTENT IN OTHER MACHINES OF MY LANhttps://wordpress.org/support/topic/errorlocalhost-site-does-not-display-its-content-in-other-machines-of-my-lan/
-
share throug networkhttps://wordpress.org/support/topic/share-throug-network/
-
Open WordPress server for LANhttps://wordpress.org/support/topic/open-wordpress-server-for-lan/
-
XAMPP access from local network by another PChttps://wordpress.org/support/topic/xampp-access-from-local-network-by-another-pc/
-
Hosted video not displayed when accessed from Webhttps://wordpress.org/support/topic/hosted-video-not-displayed-when-accessed-from-web/
-
Access to local LAN shareshttps://wordpress.org/support/topic/access-to-local-lan-shares/
-
Accessing local host through iPhonehttps://wordpress.org/support/topic/accessing-local-host-through-iphone/
-
Format public webhttps://wordpress.org/support/topic/format-public-web/
-
looks good on my machine but broken from otherhttps://wordpress.org/support/topic/looks-good-on-my-machine-but-broken-from-other/
-
lan ip and domainhttps://wordpress.org/support/topic/lan-ip-and-domain/
-
Permission or CSS issue? (not sure) With an added bonus question!https://wordpress.org/support/topic/permission-or-css-issue-not-sure-with-an-added-bonus-question/
-
WP + MAMP Hosting over inTRanethttps://wordpress.org/support/topic/wp-mamp-hosting-over-intranet/
-
Website looks good on LAN but broken outside LANhttps://wordpress.org/support/topic/website-looks-good-on-lan-but-broken-outside-lan/
-
Making WP intranet with IP restrictionhttps://wordpress.org/support/topic/making-wp-intranet-with-ip-restriction/
-
[help] site works on LAN, but not through internethttps://wordpress.org/support/topic/help-site-works-on-lan-but-not-through-internet/
-
It don’t charge the CSShttps://wordpress.org/support/topic/it-dont-charge-the-css/
-
Links of file from website (intranet) to network folder not working at frontendhttps://wordpress.org/support/topic/links-of-file-from-website-intranet-to-network-folder-not-working-at-frontend/
-
Can I link to a pdf on a local installationhttps://wordpress.org/support/topic/can-i-link-to-a-pdf-on-a-local-installation/
-
JETPACK PLUGIN – Error Details: Your site host “127.0.0.1” is on a private netwohttps://wordpress.org/support/topic/jetpack-plugin-error-details-your-site-host-127-0-0-1-is-on-a-private-netwo/
-
copy to another LAN server.https://wordpress.org/support/topic/copy-to-another-lan-server/
-
Need Help Sharing LocalHost with Othershttps://wordpress.org/support/topic/need-help-sharing-localhost-with-others/
-
cant connect to local host from other computer on networkhttps://wordpress.org/support/topic/cant-connect-to-local-host-from-other-computer-on-network/
-
WordPress – local installation / media library on the nas serverhttps://wordpress.org/support/topic/wordpress-local-installation-media-library-on-the-nas-server/
-
Acceso a pagina wordpress desde otro equipo en lan no es posiblehttps://wordpress.org/support/topic/acceso-a-pagina-wordpress-desde-otro-equipo-en-lan-no-es-posible/
-
Change Locahost to local IPhttps://wordpress.org/support/topic/change-locahost-to-local-ip/
-
Media path to local network (NAS)https://wordpress.org/support/topic/media-path-to-local-network-nas/
-
Accessing site from the webhttps://wordpress.org/support/topic/accessing-site-from-the-web/
-
ERROR:LOCALHOST SITE DOES NOT RESPOND TO ITS OWN IP ADDRESShttps://wordpress.org/support/topic/errorlocalhost-site-does-not-respond-to-its-own-ip-address/
-
localhost wordpress so slow if LAN is connectedhttps://wordpress.org/support/topic/localhost-wordpress-so-slow-if-lan-is-connected/
-
Links to local network drives/foldershttps://wordpress.org/support/topic/links-to-local-network-drives-folders/
-
Can’t Access Localhost Website On LANhttps://wordpress.org/support/topic/cant-access-localhost-website-on-lan/