Hello everyone,
I’m working with Power Pages and I’m trying to redirect users to different pages after login, based on their email domain.
Scenario
- The Home Page Partial URL is set to / (as required by Power Pages).
- I have created separate pages such as:
- Users sign in using username and password, not email.
- However, each user account is linked to an email address, for example:
- sam3311@samsung.com
- john123@test.com
- Each domain has multiple users, and I may have around 5 different domains, each needing to redirect to a specific page.
What I tried
I added the following script at the top of the Home page, before the HTML:
<script>
window.location.href = "/Samsung";
</script>
Issues
- After signing in, users are redirected correctly to /Samsung.
- However, when the user later clicks on “Home”, it always redirects back to /Samsung.
- This means the Home page (/) is no longer accessible.
What I want to achieve
- Keep the Home page Partial URL as /.
- Redirect users only after login, based on their email domain:
- @samsung.com → /Samsung
- @test.com → /Test
- etc.
- Allow users to access the Home page normally when clicking “Home”.
- Implement a domain-based redirect logic that works even though users log in using username/password.
Question
- Detect the logged-in user’s email domain
- Redirect them after login to a domain-specific page
- Without breaking access to the Home page (/)?
Any guidance or best practice would be greatly appreciated.
Thank you!