Apache 修改.htaccess 建立服务器返回204解决网络感叹号问题
1.建立自己204服务器
Apache服务器,如果你的服务器安装了rewrite模块,修改网站的根目录的.htaccess。在其中加入以下代码
RedirectMatch 204 (.*)/gen_204$
RedirectMatch 204 (.*)/generate_204$
以上内容如果是根目录。访问就是http://example.com/gen_204 或者是http://example.com/generate_204
或直接使用下方最后给出的地址
2.ANDROID手机网络图标上的感叹号及其解决办法
电脑上安装有adb driver和有Android platform-tools (adb).如果没有可以从以下地址下载
链接:https://pan.baidu.com/s/1_TcWnyrkdIDtJ80zPCLGcA
提取码:urrn
安装好后,进入关于手机,找到手机版本号显示地方,连续点击版本号7次直到提示开发者模式已经打开,进入到“开发者选项”,打开“USB 调式”
手机连接上电脑,同意弹出来授权.如果没有自动弹出,可以在CMD窗口输入以下内容查看手机连接如果没有设置adb环境变量,进入到platform-tools再输入adb.
cd /xxx/xxx/platform-tools
查看是否可用,可用后如下操作
#查看当前连接手机
adb devices
adb shell "settings put global captive_portal_https_url https://www.lsan.me/generate_204"
adb shell "settings put global captive_portal_https_url https://www.lsan.me/gen_204"
# Android 8.0及以上任意选择其一
或直接禁用掉网络检测
adb shell settings put global captive_portal_mode 0
设置完后开启再关闭飞行模式或重启手机。
以上内容参考
http://www.lowlevelmanager.com/2009/07/returning-apache-204.html
(Android 出现WiFi已连接但无法访问互联网)如果设置锁屏密码时,启用了“安全启动”,重启手机后,需要再使用adb设置一次.开启飞行模式,再关闭飞行模式后生效。