Skip to content
Wireless Router

Changing the Android captive portal page

If you don’t want your Android phone to always contact a Google server when switching networks, the following article might be useful!
It’s pretty easy to switch the captive portal check URL on an Android phone. But first…

What is a captive portal?

Ever been connected to a public or hotel WiFi? Chances are, if you tried to connect to it, your phone notified you that you had to “Sign in to Wi-Fi network” – and that’s what a captive portal is: The page that has to be accepted before being able to surf on the net. In some cases like in a hotel, you might have to log in on that page too. You can read more about captive portals on Wikipedia.

But, why should I change it?

Well, on Android 6 or higher, every time you switch networks, your phone tries to access the following URL:

As we can see, – Google’s servers. We might not want Google to know our new IP address or when we switched between networks. So… Why don’t we just self-host it? It’s pretty easy.

Self-hosting it

To self-host the page, you just need a web server and some ability to return your own HTTP status code – we’ll need a “204 No Content” here.

Here’s my PHP script:

header("HTTP/1.0 204 No Content");

After that, you can change the URL on your phone.

Changing the URL

To change the URL, open up a shell/terminal connection to your phone. You can do this with a Terminal emulator (e.g. Termux) or with adb. In my case, I did it with adb and a USB cable.

To start the adb session, connect your phone to your PC with a USB cable and enter adb shell in your terminal. Accept the dialog on your phone.

Allow USB debugging
Make sure to allow USB debugging for your PC.

You should now be greeted with a shell: PhoneName:/ $
Change the URL with the following commands:

settings put global captive_portal_http_url "http://<YOUR-URL>"
settings put global captive_portal_https_url "https://<YOUR-URL>"

Replace <YOUR-URL> with your own link. Ensure that your web server does not forward http:// to https:// because that would mean a 301 status code instead of 204! You should start seeing access entries in your web server log as soon as you reconnect to your wireless network.


If you want to, you can just use my URLs – logging is disabled here:

settings put global captive_portal_http_url ""
settings put global captive_portal_https_url ""

That’s it!

You’ve now changed your captive portal link on your Android device.
You might want to change the link in your Firefox browser too.

Comments (1) for post “Changing the Android captive portal page”

  • Thank you for the explanation!
    I didn’t even know that this page was called up every time.
    Will put it into practice in the next few days.
    Very well explained, even for people who don’t understand much in the subject.

Leave a Reply

Your email address will not be published. Required fields are marked *

Comments (1)