How To Access A Local Website (localhost) from Internet with Port Forwarding

Port Forwarding

The Internet’s greatest asset – that it is instant and without borders – also happens to be a real pain for website developers. If you make a change on a site, it becomes live as soon as you push the button.

That isn’t much of an issue if you are editing a post or doing something similarly low-key – the “Preview” feature in WordPress takes care of that. But if you are making changes to your design, doing any kind of substantial editing, or in fact building a site from scratch, you have a bit of a problem.

A lot of website owners and designers get around this by working on their WordPress sites “offline”. If you do not do this, there is a great guide available here (please note that this is for Windows users).  But there is just one problem with this method – moving your completed masterpiece online.

ManageWP’s clone feature would be perfect for transferring your finished articles onto a “live” site. But as standard, ManageWP cannot “see” your offline (localhost) site, and as such, you cannot add it to your dashboard. Fortunately, there is a way around this – port forwarding.

Update (2018)

With a launch of our new Local Sync feature, ManageWP now can push the website changes between localhost and live environments with one click. No port forwarding or desktop apps needed!

Port What?

The concept is actually very simple. Everything you send and receive on the internet travels via your router – it is essentially the “gateway” between your PC and the internet. It decides, in part, what has access to your computer, and what doesn’t.

Requests for information are made via “ports”. Picture ships docking, with cargo being loaded and unloaded, and you have the right idea.

In order to easily transfer and clone your “offline” site with ManageWP, we need to make it visible from the internet using port forwarding.

Step 1 – Find Your Local IP Address

You find houses by their addresses, and you find computers by their IP addresses. It is basically the same principle. In order for us to expose your “offline” site to the internet, we need to point whoever requests to see it in the right direction.

There are two different “flavors” of IP address – local and global. Global IP addresses are unique and accessible to all. Local IP addresses are assigned to computers within a local network (for instance, your router will have assigned a local IP address to your computer). In order for your “offline” site to go online, we need to reveal your local IP address so that it can be found.

The first step in doing this is to ascertain what your local IP address is.

On Linux

Open Terminal:

Open Terminal

Run ifconfig command:

Run ifconfig command

In the above example, the IP address is on the 3rd line: 192.168.85.130.

In Windows 7

Click “Start”, type “cmd” into the search box and press enter.

CMD

Once you have the command prompt in front of you, type “ipconfig /all”:

ipconfig /all

Scroll down until you find the IPv4 Address:

IPV4 Address

Above you can see the IP address for the computer: 192.168.85.129.

On Mac

Open Terminal:

Terminal

Run ifconfig:

ifconfig

From the information above, we can see that the computer’s IP address is 192.168.85.128.

Step 2 – Forward Your IP Address

Going back to the concept of port forwarding, here is what we know – internet browsers typically try to access web servers via port 80. So when ManageWP tries to connect to a website, the attempt will typically be made via that port. As such, we need to tell the router to redirect requests via that port to your computer’s local IP address.

This is where the process can get complicated, because there are literally hundreds of router brands with different user interfaces. Luckily for us, there is an enormously comprehensive guide to port forwarding here.

Port Forwarding

Due to the common issues that may occur best practice is that you forward some other port rather that port 80. Because port 80 could be used depending on your ISP equipment, for remote web management of router, or its used by some other program such as Skype. This guide will show you how can you do this under Windows and with XAMPP.

When this is complete, next step is to find your external IP address. Just visit the site: showip.net.

Now you are good to go. Add your site to ManageWP in format: http:// MyExternalIPAddress : PortNumber then clone to your heart’s content (follow the instructions in this video if you are not sure how).

Creative Commons image courtesy of John Morgan

Tom Ewer

Tom Ewer is the founder of WordCandy.co. He has been a huge fan of WordPress since he first laid eyes on it, and has been writing educational and informative content for WordPress users since 2011. When he's not working, you're likely to find him outdoors somewhere – as far away from a screen as possible!

14 Comments

  1. american sign language vri

    This article will help the internet viewers for creating new blog or even a blog from start to end.

  2. julian

    I had a go at this but I think the advice at ‘Port Forward’ was out of date, so I was unable to complete the process. The ability to clone with Orion from localhost would be so useful to so many people, i think you should make sure to provide updated information.

  3. Matt

    In my console, it tells me Server IP addr is not in valid range !

  4. Evgeny

    Router-based port forwarding will fail if your ISP filters incoming connections or uses NAT. In this case you can use a port forwarding service like Portmap.io or ngrok.

  5. Zeus_Zdravkov

    showip.net is showing me my domain instead of my IP! What to do? I have screen shot (screenshot to gamingpro@myself.com and I will reply with it)

  6. fatima

    Hi I am making a website and new to WordPress I did some work on website using localhost xampp I want to share my site to friend for view some issues without making it live plz guide me how do I do that help really appreciated

  7. Ribbit

    Hi, in my opinion, this is useful information, but lack of few steps. And yeah usually port 80 is taken by skype:) good look with port forwarding 😉

  8. dw7bkw

    You need to configure your firewall if you’re using windows. Add a rule to windows firewall for inbound and outbound both TCP and UDP with desire port and application then you can configure your port forward to your router.

  9. James

    I have localhost:90 on set up with xamp, forget about the router difference, generally speaking, how can I configure the router to open this port to the internet.

    1. arslan

      you need to specify both internal and external port for forward …for the above statement

  10. Mikkel

    I use PageKite when I need to let customers take a quick look at a local development site, and don’t want to start migrating the latest state to a staging server. Take a look at it at pagekite dot net

  11. pcaWeb

    I successfully forwarded the port on my router as per instructions and added the localhost site to ManageWP. However, when attempting to clone an existing site to my localhost installation I get this error:

    “Error: Could not resolve hostname”

    Any tips?

    1. martijnkraan

      Same here!

    2. jpw94

      To get ManageWP working properly, you should not use http : //localhost:port/directory when you add the site. Rather you need to specify your public IP address when adding the site: http ://xxx.xxx.xxx.xxx:port/directory
      It will then resolve properly.

Leave a Reply

Your email address will not be published. Required fields are marked *

Over 65,000 WordPress professionals are already using ManageWP

Add as many websites as you want for free, no credit card required. Sign up and start saving time!

Have questions? Get in touch!

Over 65,000 WordPress professionals are already using ManageWP

Add as many websites as you want for free, no credit card required. Sign up and start saving time!



Have questions? Get in touch!

Over 65,000 WordPress professionals are already using ManageWP

Add as many websites as you want for free, no credit card required. Sign up and start saving time!



Have questions? Get in touch!

Over 65,000 WordPress professionals are already using ManageWP

Add as many websites as you want for free, no credit card required. Sign up and start saving time!



Have questions? Get in touch!