Handle url redirection properly and rectify the internal url page detection

Handle url redirection properly and rectify the internal url page detection