I can connect to WiFi but all websites refuse to connect
Try using a VPN, I recommend Thunder VPN if you are an Android user.

So far, this is the only solution that I thought of and that is what worked for me, but there are also other VPNs.