Redirecting the logged in users to a specific page Answered
Hi you all!
I have a page that is only visible for logged in users. When users access this page and are not logged in, they are redirected to login page. In this moment, when they login, instead of being redirected to the previous page, they are redirected to the dashboard, that is the page set by default to be redirected on login. How can I solve that? I have some pages that I need the users come back after login, and just in this cases, overwrite the default redirect setting.
Comments
11 comments
https://webflow.com/made-in-webflow/website/redirect-to-attempted-page
Thaaaaank you!
Quick question:
My success page is the dashboard, so, after pay the user is redirected to this dashboard.
If I put this code in the dashboard page:
The script will run only if there is an URL in the local storage, right?
That’s correct.
I’m thinking that this script will also affect in undesired cases, for example:
In my case, I only need this to work with a couple of URLs, does it make sense to make the script work in reverse? That is, instead of having a list of excluded URLs, to have a list with the URLs that I want to save in local storage.
Like this:
Does it make sense or have I done something wrong? 😅
cc Julian Galluzzo
I believe Julian created the original code for that so he’ll be best to answer that question 🙂 Julian, if your busy, just let me know and I’ll give an answer a try.
Checking now!
Lucas Suárez check this out - I made this one yesterday for someone else and i think it captures your situation perfectly.
No problem!!
I’ll check it and let you know. Thanks Julian!
Hey memberstack team! sorry if this is a noob question - how can I redirect signed in users to the homepage if they somehow land on the sign-up and log-in pages? The screenshot below didn't work - thanks
Hey Heather B, nothing is a noob question.
I hope this will solve your use-case perfectly:
https://docs.memberstack.com/hc/en-us/articles/13156905423899--Code-Redirect-Logged-in-Members
perfect thank you 😊
I am now trying to do a similar redirect for a sign up page that allows users to join another plan e.g. an author sign up page. If a member who is already an author lands on this page, I want them to be redirected, however the code I generated (which is like the script in your link with more checks) is not working, do you have any ideas please?
Please sign in to leave a comment.