How to redirect user to a third-party site?

Context

A) https://appname.co

  • This is the main login URL for our product

B) https://abcbusiness.appname.co

  • We also sell our product to other business with a different URL. We add the business and our app name together for the new URL.

However, there are cases where user of B ended up at A login page. This maybe due to the search result since URL B contains the same keyword as A. Both also have the same interface. Only the URL and business logo are different.

Currently, when the user tried login in A using their credentials, the system will detect they are the users of B. We will then prompt a banner with the link at B so user can click and re-direct themselves to the right login URL.

Is there a better way than this?