Create a rule
Some concepts : rules and ruleset¶
A redirection.io rule is basically made of two items:
- a Trigger, which defines the conditions when the rule must be executed ;
- an Action, which defines which operations the rule must perform.
It is also possible to associate Examples to a rule, which help test and check the result of the rule, in a similar way to unit tests.
The complete list of Rules is called the Ruleset.
Triggers define the way redirection.io agents will match incoming requests before performing an action. Triggers are based on the request URL pattern. See the Triggers and markers reference page for more informations.
This section lists all the Actions than can be configured in a Rule and executed using redirection.io:
- Redirection: execute an HTTP redirection ;
- Page not available: return an HTTP error, for urls that you knowingly want to disable ;
All those actions are precisely defined in the Actions reference page.
How to create a rule¶
Of course, creating and managing rules is the way to go in order to benefit from redirection.io. Creating rules is rather easy and straightforward:
- head to the dashboard of your project
- hit the "Rules" menu link
- click the "Add a new rule" link, on the upper right corner of the page
fill the rules creation form. You may use the "Add marker" button to insert markers, which are re-usable items that we will collect from the incoming URL. For example, if the url to match is of the form
<ID>an integer, you can type
/shop/products/and then hit the "Add marker" button, and insert an "integer" marker (name it as you like). In the "Action" section, you can then use this newly created marker! Read more on markers
- click the "Next" button, this will test the rule against the examples that have been created in the "Matching" step.
- Check that the new rule has the expected impact on the current traffic. The "rule impact" is computed on the logged traffic, which means that, if your agent has only been recently installed, you could not have the full picture of the rule impacts.
- If everything looks right, click the "Add a new rule" button. The rule will be saved, but won't be immediately applied to your production: your first have to "publish" the changes.
Changes publication and history¶
Once you have made several changes to your ruleset, you may want to apply these changes on your instances:
- look at the top of the screen: the orange bar shows that there are unpublished changes in your draft ruleset. This means that new rules have been created, but are still not published - they are invisible to the agent instances.
- once you have reviewed the changes, you may publish them using the "Publish changes" button. This will ask for an optional publication comment, the right place to explain what you just did for later understanding.
- after a few seconds, depending on your plan, the new rules should be applied to your instances. Head to the project's "instances" screen, you should be able to see which instances are up-to-date.
When are my rules applied ?¶
Your newly created redirection rules should be applied on your website after a short delay, depending on the plan that you are using - this usually ranges from 10 seconds to 10 minutes. You may want to check which agents are up-to-date on your project's "instances" screen, which lists running instances, when they have been updated, and how many rules they are using.