I have an app that dynamically displays profile information based on the path of the url to create a profile page for users, such as www.app.com/p/username. This page and its data is publicly accessible, just like the basic information on your Facebook profile – one does not have to be a registered user of the app (or be signed in) to view it.
I’ve set up a custom workflow so that if the path of the URL is empty, the site will redirect to the homepage, but I’m struggling with how to redirect to the homepage if the user types in an invalid username that is not found in the database (username is a field that is given to all Users upon signup, so everyone with a profile will have a set username).
I think I understand the logic of it: I want to search the database for all Users’ usernames, and in the event that the path does not contain a valid username, the website should redirect to the homepage.
I’m just struggling with the syntax.
Can anyone help? Thanks in advance!