I had this problem with my Galaxy and I struggled to find a solution for months. But today, I upgraded the firmware on my ROUTER (nothing to do with my phone) and voila! My phone connected straight away to my wifi.
Might be worth checking your router firmware.
Goodluck :)