π This article describes optimizing the SpeedWorkers page inventory by delivering redirect pages according to your defined rules. SpeedWorkers is part of Botify's Activation Suite, available as an option with a Botify Pro or Enterprise plan.
Overview
When you know certain URLs will be redirected you can deliver a 3xx response and redirect instead of SpeedWorkers fetching and rendering the page.
Defining a 3xx Redirect Rule
Create an inventory optimization rule in the SpeedWorkers settings as described in the Optimizing Page Inventory article.
To define a 3xx redirect rule:
In the Title field, provide a descriptive title to help identify the list and, optionally, a description.
In the Scope section, define URL-based rules (e.g., URL ends with /resources) to identify all pages where you want to serve static 3xx pages.
Click the Add a Condition link to identify an additional URL-based rule. By default, additional rules will be as an "And" condition (i.e., both rules must be met). To identify an "Or" condition (i.e., one or the other rule must be met), click the "And" link between the conditions to change it to "Or".
βIn the "Redirection strategy" section, identify the HTTP code and the redirection strategy to be used when the pages in scope are requested:
HTTP code:
301: Permanent redirect
302: Temporary redirect
Redirection strategies:
Redirect to a single URL: Identify the URL where all pages within the defined scope should be redirected.
Custom JS redirection: Write a simple JavaScript algorithm to generate the new URL from the current URL and set it as a redirect.
Click Create.
Writing a Custom Redirection
Using a custom JavaScript redirection allows you to generate the redirection URL from the current URL automatically. This can be useful when you have multiple pages removed or their path has changed. For example, to redirect some of your blog pages with a new path, you can configure a section that matches the old path and generate a redirect to the new path (e.g., original URL: https://botify.com/blog-posts/article-title new generated URL: https://botify.com/blog/article-title).
To create a custom JS redirection:
From the "Redirection strategy" dropdown in the "Redirection strategy" section, select Custom JS redirection.
In the JS code text box, type the custom JavaScript.
In the Test URLs text box, type the URLs where you want to test the redirection, one URL per line.
Click the Test it button.β
The original and destination URLs are displayed in the Output section if the JavaScript is correctly formatted.
See also: