What you need:
- WP-CLI
- WAMP
- A WordPress instance
- Notepad++ or any other text editor
Open a Command Prompt window and write the following command:
ipconfig all
Look for the IPV4 address. That is your computer's local network address and should look something like this:
IPv4 Address. . . . . . . . . . . : 192.168.1.xx
Keep in mind the first three sections of it (in this case: 192.168.1). That is the subnet and every device on that network has an IP starting with those three numbers.
-
Open your apache httpd.conf file. It can be accessed by left clicking the WAMP tray icon > Apache > httpd.conf.
-
Find the line that says "Controls who can get stuff from this server."
-
Find the row containing the onlineoffline tag and add subnet to it.
onlineoffline tag - don't remove
Require all granted
Require ip 192.168.1
- If you have your Windows Firewall turned on, you should turn it off.
- Exit and start WAMP server.
- Click on the tray icon and click on Put Online.
- You should be able to connect to your server from the LAN using the complete IPV4 address we've found out using Command Prompt. (192.168.1.xx)
Now you should be able to connect to your server but cannot access any of your WordPress instances because the home directory is currently set for them to localhost.
Open Command Prompt and change the current directory to the WordPress installation that you want to access from the LAN. Type in the following commands:
wp option update home http://192.168.1.xx/wordpress
wp option update siteurl http://192.168.1.xx/wordpress
"192.168.1.xx" is your local IPV4 address. "wordpress" is your site's location on localhost (localhost/wordpress)
Finally run the last command:
wp rewrite flush --hard
That's it. Now you can access the WordPress instance from the lan by typing "http://192.168.1.xx/wordpress" in the browser address bar.
Did I mention that both devices should be connected to the same Local Network? Don't forget that as we have three routers now. :))