Skip to content

Instantly share code, notes, and snippets.

@abaicus
Last active July 27, 2016 14:23
Show Gist options
  • Save abaicus/ee8597bbed71caadeceb9a3175ca6c3b to your computer and use it in GitHub Desktop.
Save abaicus/ee8597bbed71caadeceb9a3175ca6c3b to your computer and use it in GitHub Desktop.
Access your WAMP server from the LAN

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.

  1. Open your apache httpd.conf file. It can be accessed by left clicking the WAMP tray icon > Apache > httpd.conf.

  2. Find the line that says "Controls who can get stuff from this server."

  3. 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

  1. If you have your Windows Firewall turned on, you should turn it off.
  2. Exit and start WAMP server.
  3. Click on the tray icon and click on Put Online.
  4. 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. :))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment