Web Applications Stack Exchange is a question and answer site for power users of web applications. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

A simple method we often use when developing changes to web applications for which we don't have control over the DNS is to let the testers add a line in the Windows hosts-file that points to the public IP address of the test environment (for one, McAfee uses this method for their staging environment).

I was wondering whether a similar method is possible on the Android and IPhone, i.e. to add a host lookup entry for a hostname. This would make testing certain webapps quite a bit easier for us.

share|improve this question
Asking on the Ask Different and Android Enthusiasts Stack Exchanges might be a better idea. – Al E. Nov 10 '12 at 19:41
up vote 2 down vote accepted

Yes you can do it by adding entries to the /etc/hosts file in the same manner as you do in windows.

This can be done on a jail-broken iPhone relatively easily (either via SSH or a terminal app on the phone) and similarly from rooted Android. As far as I;m aware it can't be changed from Application code.

Another option you might want to look into is running a Custom DNS server on your internal network but that might be more work than your after.

share|improve this answer
Thanks for answering. I assume that a rooted Android is not something the average user will have knowledge or access to? Would an app be able to take control over this, so that a potential tester would only need to install the app? – Abel Nov 8 '12 at 13:31
@Abel: You might want to have a look at this: Guide to editing /etc/hosts – Al E. Nov 10 '12 at 19:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.