This happened to me yesterday. I've purchased brand new iPhone 4S, upgraded to iOS 6 and was unable to get Wi-Fi working as it was getting disabled after sending to 404 apple page.
It got fixed in rather weird scenario: I did a full reset erasing data and content, had to reactivate device via WiFi - it still tried to open 404 page (but since it is activation screen, it automatically closed it), but then I have turned on another WiFi router, tried connecting there - it failed, tried connecting to original WiFi router - it got connected, "next" button appeared and I quickly clicked it. The device got activated and after that, this opening of 404 page no longer occurs.
For some reason, I think the device thought that WiFi required web-based authentication, which is why it was trying to open that 404 web page. I'm still unsure how and why it worked, but at least in my case, it's gone now. I hope it won't reappear if I decide to reset the device again.