A web page that needs redirection is processed correctly with this code; otherwise not. All pages (that I have seen) have a newURI.Host that = '' and only pages with redirects need to have the ASrc URL encoded. Pages without redirects do not need any "encoding" of their URL.
Uh... every website is forced to redirect in case a page requires redirection ? If not, then the webserver is not following the rules of the internets (if even a 404), so indeed the ondirect event will not work for you as it never will result in an empty URL.
I'm not sure what you are trying to accomplish, but....
How can I tell when the web page needs to go through this loop. It doesn't seem to be when
(newURI.Host = '')
... that seems to suggest that you wish to process the url (in some for me uncomprehending way) before (fphttpclient is) doing an actual redirection.
If that is the case then set AllowRedirect to false, and handle the returned error-code from the webserver yourself, that should be in the 303 range (
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_Redirection)
If not mistaken then you can set the allowed error-codes, so that fphttpclient won't bail out with an exception, and you can check for that return value. You would have to redirect manually in case that is still required.