better logic for internal domains, catering for redirects