How do you access a website running on localhost from iPhone browser

0 votes
asked Jun 28, 2010 by rams

I am working on a mobile website and would like to test it using my iPhone browser. My Windows 7 machine and iPhone are on the same wireless network. How do I access localhost from the iPhone? Right now I get a 404 error.

20 Answers

0 votes
answered Jan 28, 2010 by cuss

Try this:

  1. Press Windows + R
  2. Open cmd
  3. Run ipconfig
  4. Check your wireless network card IP
  5. Go to iPhone and navigate to "" through your browser.
    ( is your IP)

Note: you must set permission on your firewall settings, if any.

0 votes
answered Jun 28, 2010 by wil

Accessing localhost from the iPhone will simply do a loopback / try to connect to itself (If it supports that?).

What you need to do is find the IP of your desktop machine (e.g. If Windows, go to the Command Prompt and type ipconfig or go to Network and Sharing Centre and look up connection status.

Once you have your ip, simply visit that from your browser e.g.

You may need to open up port 80 (or whatever port your website is running on) in the inbound security of your firewall if you are running one.

0 votes
answered Jan 5, 2012 by big-rich

Have a look at this answer, it discusses internally routing HTTP through direct Objective-C calls to an HTTP-capable layer/embedded web server (let's assume that the HTTP server code is within the same application that wishes to display the HTML within a web widget).

This has the advantage of being slightly more secure (and possibly faster) as no port(s) should be exposed.

0 votes
answered Jan 18, 2012 by ecko

If you're using MAMP, key in your IP address (let's say in your iPhone Safari browser, followed by the port number 8888 (e.g. and you will be able to see your local site in your iPhone.

And if you're using a WAMP server, again in your iPhone safari browser just key in the IP address (let's say and that's it. But don't forget to remove the deny from all from the httpd.conf file for your WAMP server. If you look for the line allow from, above it or below of it you will see deny from all; just delete this line and restart your WAMP server and that should to the job.

0 votes
answered Jan 24, 2012 by kyehan

You can use ip of computer instead http://localhost.

But it may be not accessible. You must edit the httpd.conf (or equivalent configuration file) of your server software. I do not have php installed right now but you can search with keyword: "Allow from or /Directory"

Note: IP of the PC where XAMPP is running should be a static IP(not assigned by DHCP), otherwise you have to check it manually every time you restart the PC.

0 votes
answered Jan 11, 2013 by drhoovercraft

I wanted to accomplish the same thing as the original request, and looked for an answer here, and turned off every firewall and virusprotection to no avail.

Then, I found the following statment regarding IIS express in the microsoft documentation: "IIS express does not serve requests to a browser on another computer, making its approval easier in corporate environments".

Bottom line - you will have to install IIS (not the delivered IIS express) to get your project to be seen outside your computer.


Hope this is helpfull to other people that are going nuts turning off every security feature on their computer.

0 votes
answered Jan 29, 2013 by yassin

If you are working on a php project you can change the base href:

<base href="<?php echo str_replace("localhost","192.x.x.x",HTTPS_SERVER);?>">

  • localhost or depending on your settings
  • 192.x.x.x : your local ip address
  • HTTPS_SERVER: the previous base href

Doing that is essential to load images, css and js files on your phone.

0 votes
answered Jan 3, 2014 by fatih

If you are using Mac, go to System Preferences > Network and use your IP address instead of localhost. You can also use port number. In my case, I have a server running on port 1448 and I can preview using iPhone.


0 votes
answered Jan 16, 2014 by t-todua


1) you should click on WAMP icon>Put Online (wait till re-started).

2) Then (if you are WiFi on Iphone on same network), open your IP in iPhone browser

i.e. OR

To find your local IP's:
a) click Start>Run>cmd and type ipconfig ,then you will see there.
b) click the blue arrow and "lease new ip".

p.s. That's all. now you can access (open) localhost from Android or iPhone

0 votes
answered Jan 12, 2015 by tum

In my case first i connected my pc and mobile on the same network, you can ping your mobile from pc to test the connection.

I running my project with GGTS(Groovy/Grails Tool Suite) locally then accessing website from mobile using PC IP address and it's work very well.

PS. running from local it would give url like (http://localhost:8080/projectname) you should replace localhost with PC IP address if you are trying to access your local website from mobile

Welcome to Q&A, where you can ask questions and receive answers from other members of the community.
Website Online Counter