If your Algolia redirect rules aren’t triggering as expected, it’s usually due to how they’re implemented and which frontend library you're using. This guide explains how redirect rules work depending on your setup; whether you're using the Visual Editor, Manual Editor, the API, or you're not using Algolia's frontend libraries at all.
General Requirement: Frontend Handling
Regardless of how the redirect rule is configured, Algolia does not perform the redirection itself. Instead, the rule returns a redirect URL in the API response. You need to read this value in your frontend code and manually trigger the redirect. How you do this depends on the frontend library in use.
Using the Visual Editor
If you've set up a redirect rule using the Visual Editor, the redirect URL is returned in the API response under the renderingContent.redirect property.
If you're using Autocomplete, you can use the Autocomplete redirect plugin, which handles this automatically.
If you're using InstantSearch, you need to create a custom widget that reads the
renderingContent.redirectproperty and handles the redirection manually.
Using the Manual Editor
If you created a rule using the Manual Editor and used a userData consequence (instead of renderingContent.redirect), you'll need to handle the redirect with the queryRuleCustomData widget in InstantSearch.
Example:
consequence: {
userData: {
redirect: "https://www.algolia.com/support"
}
}Using the API
If you've added a rule via the saveRule method and included a renderingContent.redirect value, it behaves like a Visual Editor rule - the redirect is returned in the response and must be handled on the frontend.
Alternatively, if you use userData in the consequence (like in the Manual Editor), you must implement redirection using the queryRuleCustomData widget or equivalent logic.
Not Using Algolia Frontend Libraries?
You can still use redirect rules. Just parse the API response yourself and handle the redirection manually:
For Visual Editor or API rules with
renderingContent.redirect, read the value from that field.For Manual Editor rules using
userData, extract the redirect value from theuserDataproperty.