Forum Documentation Showcase Pricing Learn more

Redirect to homepage if username is not valid


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 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!


Would also like an answer to this!


I figured it out.

I created a workflow on page load that does a search for users whose username is retrieved from the path of the URL. If that search returns zero results (count:0), then it will redirect to the homepage.

Hope that helps!