Redirecting using Locksmith
How to use the Locksmith app's redirecting features to make sure your customers arrive on the intended page
Out of the box, when a Locksmith lock is activated on a specific page, Locksmith will block acess to the main content of the page (i.e. everything in between the header and footer). The main content will then be replaced by Locksmith's access denied content, which might be a sign-in page, a passcode prompt, or simply a message letting the customer know that they don't have access (depending on what keys and settings you are using).
Then, of course, once a customer gains access, they will be shown the content of the page normally.
While that is the default behavior, you also have the ability to send customers to a different page before or after they gain access to the content. So in this way, there are two types of redirecting - redirecting customers right away once they arrive on the locked page, or redirecting customer once they gain access.

Redirecting customers immediately when they arrive on a locked page - before they can gain access

To redirect customers this way, you'll simply use a regular Javascript redirect script, and enter it into the "Messages" area in Locksmith. More information on the messages area here:
This is an example of a simple redirect script:
<script>
window.location = 'https://www.example.org/my-example-page-url';
</script>
The only thing you'll need to change is the exact URL. Use the full URL whenever possible (as opposed to partial URLs).
In Locksmith, this will look something like the following:
Tip! Redirect scripts can be used on any type of key condition, including customer account keys, passcodes, secret links, etc.
Also keep in mind that in the case of customer account keys, you have the option to define different messages(or behavior, in this case) based on whether or not the customer is signed in when they arrive on the page. So, you could redirect customers that were signed in (but still didn't have access), for example. This would look like the following:

Redirecting customers after they've gained access

Locksmith also has the ability to redirect customers once they've arrived to a page that they have access to. This could be useful if you wanted to show different pages to different customers once they've gained access. Passcodes is an area that this is frequently used for.
So - for example: three customer groups that each need to see a different collection. If I have a landing page that I put a Locksmith lock on, we can use the redirect feature to send each customer to a different collection, depending on which passcode they've entered.
The redirect-after-access feature is found in the key settings, accessed with the ellipsis (...) to the right of each key:
Since this is a key setting, you can set a different redirect for each key. Notice in this example that each key is redirecting to a different collection URL:

Related articles

Copy link
Outline
Redirecting customers immediately when they arrive on a locked page - before they can gain access
Redirecting customers after they've gained access
Related articles