Keycloak Deep linking the application base url

We have integrated the keycloak with our Vue js applications and it’s working fine without any issues. Whenever any activity happen in the platform, will trigger the mail with link to access it. If user is logged in, they are redirected properly to that activity place but if they are not logged in they will be redirected to Keycloak login page after that they are redirected to the base url but the query params are getting removed. Because of that the page looks empty, check the reference below

**Base url before in the mail:** https://website.com/coursePreview?course_id=1233&state=2221
**Base url after login:** https://website.com/coursePreview

From the application side, we have handled the deep linking, but we are struck with the keycloak side. We are checking the keycloak docs and stackoverflow answers, but we are not able to find any correct response. We found similar issue in stackoverflow, but that’s not working if user is not logged in here