Access WordPress localhost from devices on the local network

Access Wordpress localhost from devices on the local network
Home » Technology » Wordpress » Access WordPress localhost from devices on the local network

Table of contents

If you have WordPress installed on localhost with XAMPP you may want to test your website from your mobile device to check, through a real device, its mobile compatibility or mobile friendly. Well, to do this, below we will explain how to access WordPress localhost from other devices on the local network:

  • Access the Windows console, to do this type “cmd” in Windows search and select the “Command Prompt” option.
  • Get the IP address of the computer where we have XAMPP installed with WordPress by executing the “ipconfig” command and noting the value of the “IPv4 Address” line.
  • Open the Windows firewall through the “Firewall and network protection” menu option.
  • Access the applications allowed in the firewall through the “Allow an app through firewall” option.
  • Add “Apache HTTP Server” to the list of allowed applications from the “Allow another app…” option. The path, if you have not changed the default one in XAMPP, is “C:\xampp\apache\bin\httpd.exe”, in addition, it is possible that you already have this application in the list so this step would not be necessary.
  • Configure “Apache HTTP Server” by selecting “Private” and “Public” and checking the box on the left that indicates whether or not an application is allowed through the Windows firewall.
  • Change the WordPress address to the IP that we noted previously through “General Settings” of WordPress.
  • The previous step is necessary so that WordPress images, links or styles load correctly on other devices. If we skip this step we could access WordPress localhost from other devices on the local network but the web resources would not load correctly.
  • Review and fix WordPress links so that they are relative paths instead of absolute paths. We have an example of this in the site icon that, if we click on it, does not redirect us to the home page correctly, simply insert an image and as a link set the path relative to the homepage of your website.
  • Finally we verify that we can access WordPress localhost from our mobile phone connected to the local network through the route “https://ip/folder-wordpress-htdocs”.