Redirect Login page to Membership Request page

I have two site collections: https://myportal/collection1 and https://myportal/collection2

  • I configured FBA on SharePoint 2016
  • Deployed SP 2016/2019 FBA Pack
  • Created a RegistrationForm.aspx with Membership Request Web Part
  • Created a custom FBA login page (I copied default.aspx and made some changes: added logo)
    Everything works fine.

Now I need help redirecting the login page on the registration form (for new users).
I need a link on the login page that would lead to the registration page in the site collection that the user is trying to access (e.g. if the user is trying to access https: // myportal / collection1to take it to https: // miportal / collection1 / SitePages / RagistrationForm.aspx, and if the user tries to access htps: // myportal / collection2 to take it to https: //myportal/collection2/SitePages/RagistrationForm.aspx).
This way I would also solve the problem of linking to the web page in the message the user receives after registration.
I am new to this field and I need help.
I hope you will help me
Best regards

Since users in a web application are available to all site collections, you are probably better to just have a single registration page (Whether they were registered in collection1 or collection2, they will be visible to both site collections). Permissions are separate between site collections though, so I assume that’s why you want to have 2 separate registration pages - different default permissions depending on where they register? The only way I can think of doing it is parse the login page’s returnurl url parameter using javascript and replace the link to the registration site depending on what the returnurl is.

If you want a completely separate set of users between the 2 site collections, then they should probably each be in a separate web application.