Web app auto-redirecting to the initial page on iOS problem (it should NOT redirect)

From the scenario that you have explained, the page might get reloaded if internetChanged method is getting called in an unexpected scenario.

I can see that scenario happening if the network status of the device is changed while the viewController is shown. You have observed a notification in method func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!). so when the network status is changed, the internetChanged method will get called. In both if and else of the method, there is logic to load the webView.

Also i can see that, you have observed the notification but never removed the observer. So ViewController will have memory leaks and might not get deallocated from the memory. I would suggest you to remove observer in deinit

One more thing is, you can better observe the notification in -viewDidLoad instead of didFinish method. Now what happens as per the current logic is, whenever the webView is reloaded a new observer will be added to the ViewController in the method func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!). So let's take somehow internetChanged method is called 3 times, then 3 observers will be added. So the next time when network is changed, it will make internetChanged getting called thrice leading to webPage getting loaded 3 times one after the other and the cycle continues.