How to access localhost from mobile device
When you are designing your mobile compatible website on your local environment, you may want to test your website on your mobile device. This is to make sure it works on mobile devices before you deploy it to a live or production environment.
Many time, you just have to enter the IP address of your machine into your mobile browser and it works. But sometimes, you may have to configure your Windows Firewall, or Apache Server to make it work.
The following instruction will make sure you can access to your localhost on Windows from your mobile devices.
Step 1: Add new rule for port 80 in Windows Firewall
Open Control Panel -> Firewall & network protection -> Advanced setting -> click on Inbound Rules -> Click on New Rule to create a new rule for Windows Firewall.
Select Port and click Next
Enter 80 for Specific local ports and click Next
Click Next
Click Next
Enter Port 80 and click Finish
Step 2: Find IP address of your localhost machine
Open cmd and type ipconfig. The IP address is on the line “IPv4 Address“
Step 3: Open the browser on your mobile device and type the IP address that you found in step 2
Now you should see your website on your mobile device
Leave a Reply