Sample Header Ad - 728x90

How to set up a host to IP mapping on unrooted Android?

23 votes
6 answers
105363 views
I've a website running on my computer, and I want to test it from my Nexus 7 tablet. I.e. over the local WiFi LAN. If I type in the IP address it connects, but shows the wrong web site, because I'm using named virtual hosting. So, what I want to do is be able to type mysite.local in to Chrome/Firefox on the Nexus, have them convert that to 10.1.2.3 (or whatever the local IP address is), then call the 10.1.2.3 server giving mysite.local as the Host to request. *My Question:* Does an Android 4.x tablet have an /etc/hosts files, or equivalent, that I can edit? (Without having to root the tablet, or anything like that.) On my Linux computers I do this by adding an entry in /etc/hosts: 10.1.2.3 mysite.local (Or Windows\System32\drivers\etc\hosts on a Windows machine does the same.) BTW, this is a semi-duplicate of https://android.stackexchange.com/q/9633/36187 , but that question was for Android 2.2, where apparently it was not possible. (One of the alternative ideas suggested there was configure DNS at the local router, but as far as I can tell my router does not do DNS locally so does not have that option. I could set up my own DNS server to do this, but that feels like a Big Job Solution.)
Asked by Darren Cook (393 rep)
Jul 29, 2014, 08:36 AM
Last activity: Jun 7, 2024, 03:18 PM