Is there any way to block access to a particular website through the stock Android browser?

  • To filter adult content in web browser apps you can use "Mobile Security" which has parental controls plus backup and antivirus features for mobile.
    – patchie
    Dec 4, 2011 at 14:09

2 Answers 2


If you have root, you can mount the systems partition as editable and edit the hosts file and set the site in question to redirect to This is somewhat complicated voodoo, however, and I wouldn't recommend it if you don't know what I'm talking about already.

However if you don't want to do this manually and have rooted your phone, the app Hosts Editor is a nice little single purpose utility just for this.

If you're up for the voodoo, and have ADB installed:

  1. From the terminal invoke the adb command with remount option otherwise you will get "failed to copy 'hosts' to '/system/etc/hosts': Read-only file system".

    adb remount

  2. In the terminal pull the default hosts file from /system/etc/hosts or /etc/hosts which is the symlink of the file not only for backup purpose but also to get the file to modify.

    adb pull /system/etc/hosts <path to pull hosts file to>

  3. Modify the file according to your needs. (eg) www.somewebsite.com

  4. Push the file back to the phone:

    adb push <path you pulled hosts file to>/hosts /system/etc/

  5. That's it. You can check it out from the shell:

    adb -e shell

    cat /system/etc/hosts



The simplest way to block access to a website is by adding that domain name to hosts file as mostly DNS resolvers honor that file. But it's not possible to edit /etc/hosts without rooting Android device. Here are a few options you can go with on unrooted device:

  • Use a VPN app which intercepts DNS traffic and looks up a custom hosts file before making queries to configured upstream DNS server.
  • Run a DNS server; they can be configured to return a predefined IP address for a specific name. For instance if using dnsmasq, add address=/xyz.com/ to “dnsmasq.conf”. Or on dnscrypt-proxy add xyz.com to “cloaking-rules.txt”.
  • Configure phone to use a proxy or VPN and then add the entry xyz.com to hosts file on proxy server or run a local DNS server on VPN server.
  • If bootloader is unlockable, edit hosts file from custom recovery.

For more details see: How to always resolve a domain name to a fixed IP without rooting?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .