How to Access localhost on Android over wifi

Accessing the localhost over the wifi on my android phone was not easy task for me, many configuration needed to done. I am writing these steps which worked for me. These steps are applicable on Windows 7.

Install the Wamp server

This is one of the best server I know to set up local server. If you have installed Apache or any other server then ignore this step.
Download and install Wamp Server from here.

Add New rule for port 80 in Windows Firewall setting

1. Open control panel and select Windows firewall

2. Select Advanced setting from left panel of Windows firewall setting page.

3. Select Inbound Rules from left panel(1), next Select New Rule(2).

4. Select Port and click next

5. Select “Specific local ports” radio button and enter 80 as a port value.

6. Keep Allow the connection unchanged and move to next.

7. Keep Profile options unchanged and click next.

8. Give some nice name to your New rule and click on Finish.

This will enable port 80 access on local network ip.

Edit httpd.conf file of Wamp server to fix 403 error

We need to edit httpd.conf file else we will get 403 forbidden error when we access the localhost through local network ip.

1 .Click on wamp server tray icon

2. OpenApache server sub menu

3. Select httpd.conf

4 .Find this section of configuration in httpd.conf file

Directory “c:/wamp/www/”
# Possible values for the Options directive are “None”, “All”,
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
# Note that “MultiViews” must be named *explicitly* — “Options All”
# doesn’t give it to you.
# The Options directive is both complicated and important. Please see
# for more information.
Options Indexes FollowSymLinks

# AllowOverride controls what directives may be placed in .htaccess files.
# It can be “All”, “None”, or any combination of the keywords:
# Options FileInfo AuthConfig Limit
AllowOverride all

# Controls who can get stuff from this server.

# onlineoffline tag – don’t remove
Order Deny,Allow
Deny from all
Allow from

Find and replace ‘’ with ‘All’, save the file and restart your wamp server.

Find your local network ip

1. open command prompt

2 .type and enter ipconfig command

3. In my case my local area network address is

This is the ip which you need to access your localhost on your android phone over wifi. To test it is working type this ip address in your desktop browser where your localhost server is installed. Browser should display your localhost page successfully. This will assure that this local network ip is now can successfully accessible on your Android phone.

I hope this tutorial will help you too access your localhost over wifi.

Sameer is a Internet technology Blogger from India. He is currently working in Mobile domain. He love to explore latest technology trends in mobile application development and Internet.

74 Responses to “How to Access localhost on Android over wifi”

  1. fanji says:

    Hi Sameer, thanx about your tutorial.

    to access my localhost from my adroid device,

    can i use localhost or to access ?

    how to make my ip address become static ( in your case)?


    • Sameer says:

      Thanks Fanji. You can not access your desktop localhost server directly using or localhost on Android phone. Because if we use the same it will assume we intend to access android phone localhost which is exactly we don’t want.
      The ip shown is actually your Local area connection IPV4 address. Execute ipconfig command from command prompt and search for “Ethernet adapter Local Area Connection:” in output. That is the ip you have to use on your android phone to access your desktop localhost server.
      I hope it helps :)

  2. harshadura says:

    Thanks for the great article, it helped a lot

  3. Ranjith says:

    Hi Sameer
    I have done all steps except that I am not able to find httpd.conf in my Apache server. Any help around this?

    • Sameer says:

      Hi Ranjith,
      I haven’t tried this with Apache server yet. I will try this and let you know. But anyways you can always use wamp server as mentioned in this tutorial.

      • Ranjith says:

        Thanks for the reply.
        I see wamp server asking to download other softwares also , does it work with java? My application is in java. I’m stuck with this for 2 days. Any help is much appreciated.


        • Ranjith says:

          Hey Sameer,
          I solved it. Basically the problem was with the opera mobile browser. :()
          I could access the page from the default browser of android. Once again thank you for the quick response.

          • suraj kulkarni says:

            can you tell me how you solved that problem ,because i am also facing same problem Apache and jsp accessing from android

  4. Aditya says:

    Thanks Sameer! Really helpful!

  5. Deepak says:

    Thanks for the tips Sameer.

  6. Aswin says:

    Really thanks,I was so desperate to get this…..

  7. Hussain says:

    Good solution Sameer, but didn’t work for me. Even after following all the steps I have a “403 Forbidden” on the device’s browser. Any troubleshooting step you can suggest? Even when I use IP addr on laptop’s browser I receive the same “403”!

    Note: I was able to hit the IP address of my laptop from my Android device’s browser even before adding the Firewall rule, it gave me the same “403 Forbidden” though.

    • Sameer says:

      Hi Hussain,
      Are you using wamp server? If yes then you have to modify httpd.conf. You have to find and replace ’′ with ‘All’ in this file. I got same error as mentioned in tutorial but this trick has fixed the issue.

      • Jacky Lau says:

        Hi Sameer, I tried it that way, but still no luck :(

        • Sameer says:

          Hi Jacky,
          Are you trying this on same wifi network? Which server you are using to host your local pages?

          • Jacky Lau says:

            Hi Sameer, I have managed to solve my problem :)

            There is actually some difference in WAMP and XAMPP…in the httpd file

            In WAMP, I realized that there was no this following line: “Require all granted”. This line exist in XAMPP and when I tried connecting to my localhost using WiFi using XAMPP, it works.

            So my solution was copying the line into the WAMP and problem solved 😉

  8. Nick says:

    Thank you!!! This works perfectly.

  9. rachid says:

    Thank you a lot , it work for me.

  10. Fauzi says:

    how to change ip address because my default lan address is

    why have subnet it is not

    • Sameer says:

      No you do not have to change it. you have to use your IPv4 address, that should work. I am not sure about the subnet mask, I haven’t configured anything in that. You should try with your IPv4 address shown in command prompt when you do ipconfig.

  11. Ritesh says:

    sir i have developed a android mobile application . in my desktop it’s working fine , i used wamp server and sqlllite database to store all user registration data. i have copied apk into my mobile(Sony Ericssion Neo V with Android 2.2) and installed this application but while registration or login it’s displaying error as below:

    The application mini_proj (process has stopped unexpectedly. Please try again.

    Please help me i am waiting for your reply

    • Sameer says:

      Hi Ritesh,
      First check that you can access your wamp server index page from your android browser. It looks like your application has been crashed on device. Connect your phone with usb and try to debug where in the code and on what condition you are getting the crash.

  12. Alex says:

    Thanks, this also works for Microsoft Webserver IIS.

  13. Charan says:

    Hi Sameer

    This is one is a great article. I am trying to access a webservice thats published in local host (Created using Axis2 from eclipse) from android Application ,using Apache Tomcat Server 7.0 . I need to connect over wifi but I am not able to. Please let me know which file to modify in Apache.

    And I have Mcafee AntiVirus installed in my System and its managing windows firewall. please let me know what to do for this??

    Thanks in Advance

    • Sameer says:

      Thanks Charan, I haven’t tried it with Apache yet. Please check this article to locate httpd.conf file for Apache server. If you can access your Apache server directly using your IPV4 address on your desktop, then no need to add any rule in firewall setting.

  14. Abbas Uddin says:

    Thanks Sameer,

    I tried more and more to access my PC’s video through android device. I’m a PHP programmer so it’s easy to do with web page but I couldn’t connect my phone with localhost.
    Your trick is good solution but I use EasyPHP as my server on windows7 32bit platform. I edited apache configuration allow from all. And nothing happened yet.

    After all I checked my another IP of WLAN and this time it’s works!

    So please aware all the visitor to access their WLAN ip from android browser it should work fine.

    • Sameer says:

      Thanks Abbas, Yes the ip which I shown in the screen shot is actually your Local area network ip (i.e. WLAN in my case too). It will not work with another ip for e.g if you are connected to another network with ethernet cable. It is necessary that your server should running on same wlan network on which your phone is connected too through wifi.

      Thanks for pointing it out :)

  15. Aks says:

    Hi, Sameer,

    i know the android marekt for mobile is much higher and strong these days.

    But, few days back i came across with the tech called “Phone Gap”.

    coulud you please shed some light on this technology by giving some nice tutorial ?
    Also, tell me whether this technolgoy will be more useful than writing the program using native lanagues for a devices ?

    if yes, then could we start looking at phone gap library as the best solution instead of any other native device library for the mobile device ?

    Waiting for your reply?

    • Sameer says:

      Hi Aks,
      Sorry it’s a bit late reply to your question. Yes Phone gap is useful when you want your application run on multiple platforms such as windows and iphone. This will save so much of your time to develop your application on multiple platforms. It depends on kind of application you are developing and whether phonegap library supports it with its set of api’s.

      If you targeting your app to only one platform then developing it in native will always give you better results in terms of performance.

      I will definitely write a post and a small tutorial about phone gap. Thanks :) !

  16. Martin says:

    You should also instruct to restart WAMP server after the change in notepad.

  17. Gangesh says:

    Thanks! :)

  18. maicon says:

    Valeu meu amigo, funcionou perfeitamente ! abraços do Brasil !!!

  19. prachi says:

    really helpful! Thanks.

  20. […] USB doesn’t provide network to mobile device. But if you are using wifi then may be this link will help you […]

  21. Regasa Alemu says:

    Hi Sameer, thanx about your tutorial. but i need that i have android application on my phone and then i need that to access the server on the LAN may be the mobile is using wireless to access the server

    • Sameer says:

      Thanks. I really haven’t tried to access the localhost server from any android application. But you can always use the your localhost ip (as shown in the post) in your code and see that if it working or not. My assumption it will always work if that localhost ip can be accessible from your default android browser after following the tutorial.
      I hope this answer helps :)

  22. Bhuvan says:

    Thanks a lot!!!. it really helped me

  23. Jacky says:

    Hi Sameer, I followed your tutorial till the end

    However, I still can’t connect to my localhost via mobile device over the WiFi even though I configured everything accordingly…can you help me?

  24. Jacky says:

    Hi Sameer! I have followed your tutorial till the end, however, I still couldn’t connect to localhost by my mobile device…any other solution? :(

    I am still stuck at Error 403

  25. Gabriel says:

    If I’m not mistaken, setting Allow to all in apache means that the localhost becomes public. This sounds like a dangerous and bad idea. Any tips on how to do this without Allow all?

    • Sameer says:

      Yes Gabriel, If you read the previous comments, Abbas Uddin had same issue. You can use your local wlan ip instead of all. I am updating the post as well. Thanks.

  26. Mohammed Owais says:


    I am not having internet at home. For using at home I bought a TL-WDN4800 USB Adapter. Which has SoftAP Mode in it.

    I followed your Instructions but I cannot Find My IP Address in IPCONFIG Command. (But In my office it worked.) And I was able to access it.

    I tried to connect it in my phone , It stops at “Obtaining IP Address from SoftAP…”

    Is there any way to create IP Address?

    Mohammed Owais

    • Sameer says:

      Hi Mohammed , Thanks for following my post. It looks like some issue in actual hardware setup cause you are not able to connect your phone to wifi network in first case. And you are also not seeing an wlan ip mean some issue in wlan setup. Are you able to connect other devices to the wifi network beside your phone, for e.g. your laptop ?

      • Mohammed Owais says:

        Sorry for the Delay , I tried and got results,

        In my Xperia U it Worked but not in any other phone.

        I tried to forget and ReEstablish Connect in my Xperia , it worked.

        Now I am able to connect to my phone but not in other…. :*(

  27. Rahul says:

    Hello sir,
    I try to type my system ip address us android moblie phone could not connected wamp server and i follow these steps and we are try to open a wamp server to another local computer to type us ip address and both time could not find a server.

  28. Arvin says:

    Hi Sammer!

    I followed your tutorial. Works well with the emulator. I tried to install my app in my android device that is connected to one wireless network where my laptop as my server connected as well but upon running my app, it’s not getting the data. Is this has something to do with my laptop connected to a domain in our company? i guess not because it is applied to DOMAIN, PUBLIC, PRIVATE as i left them unchanged (with check).

    Any idea why i cannot access it? do i need to add port 80 in the ipaddress say

    Hoping for your reply.

    thanks and regards,

  29. ajit says:

    i followed 10……2 ip address and my local machine ip or router address it works fine in emulator ,but with that same address i am not getting any msg from wamp server or my device is not register on server ,device error are like this trying to attempts to connect..
    please give some solution
    I have Galaxy -Y

  30. chamath says:

    great !!!!!!! thanks :)

  31. Srinivasan says:

    Hi this is most useful tutorial i followed the same i can access the WAMP but i am unable to get into PHP my admin if i click on the link it shows Forbidden error. I have also replaced to all in http but again the problem persist. Please do some solution for it.

  32. Muthu says:

    Thanks a lot sameer, even though the post is little old, still its helping. This is has been of great help, thanks for the post

  33. Ayman says:

    Thanks, very helpful.

  34. Janice says:


    Thanks for your tutorial.

    However I have a problem. I’m trying to connect the mobile phone to the wamp server (laptop) but it giving me error “Connection to refused” in the mobile phone.

    Could you please give me some advice ?

    Thanks in advance

  35. Sameer says:

    sir i have xampp installed on my PC, So same configuration for me ?

    Thanks :)

  36. Stanley says:

    Thank you so much,my android app is connecting to the wamp (database) and even retrieving data and i can also update the database tables on the laptop via my android app…thank you.

  37. Thembani Moalosi says:

    your method really works like a charm…. thanks a lot….

  38. Lennart says:

    Thanks for this tutorial, worked perfectly :)

  39. JohnMiller says:

    Superb! Worked immediately for me on Windows Phone 8 (Nokia Lumia 620) and Windows 8 on the PC. Very clear instructions, with really helpful screenshots – the best I could find anywhere. MANY thanks for taking the time and trouble to post!

  40. seng Keat says:

    Hi Sameer

    I have done as you said above but nothing appear at all. When i tried to types in the browser of my mobile device it showed web page not available.

    Note: I did not find the ip address of 10.0.0.x
    rather than this ip

    So what will i do in order for me to connect with the local host

    seng Keat

  41. Julian says:

    i have installed XAMPP on a win7 32 bit computer, then installed wordpress and hosted a website. i want to acces it through a wifi tablet with android on it, and it opens the website but it works too slow . i have added a portforwarding on both udp and tcp on my router,removed wpa-psk security and chose mac filtering instead ,but it still loads way too slow. on my local computer where i have the server it loads in an instant .

    i don’t know what seem to be the problem.

    i have added 2 lines on my etc/hosts file in windows like this : and . before i did this , my site was loading slow even on the pc it was hosted . also ,i have shared the wordpress folder on the network but with no succes on the speed improvement. there has to be something i have not tried. i will bring a laptop conected through a utp cable and see if the problem still persists. if not, it`s the wi-fi connection .

    any suggestions to fix this ? i have also changed the ip in the wordpress general management page , where the ip was set to default as in : with and this made all the media i add to have the ip updated to the one i set to my ipv4 settings

    my router ip is:

    my pc is :

    my tablet has no ip set , the dhcp server gives a random ip between 1 to 200 .

  42. Leander says:

    This tip is awesome, thank you!

  43. sai manohar boidapu says:

    thanks a lot sir….! very nice….! this is what i have been searching for..!

  44. mhn says:

    just thank you

  45. akhil says:

    Hi Sameer i did what u mentioned in ur post but unable to access the wamp server from mobile .shouning me unfortunately app has been crased.
    i changed the ip address as of my system ip…
    HttpPost httppost = new HttpPost(“”);

    pls assist me

  46. demir says:

    thanks man! that helped me so much:)

  47. Aditya says:

    Thank you sameer. Worked well for me.!!
    Looking forward to following you!

  48. Aditya says:

    Thanks a LOT, man!!! awesome work! i struggled for days!!

Leave a Reply

© 2017 MobiTechie. All rights reserved. Site Admin · Entries RSS · Comments RSS
Powered by WordPress · Designed by Theme Junkie