How to create redirection rules?
Of course, creating and managing redirection rules is the way to go in order to benefit from redirection.io.
Redirection rules can contain much complexity, as they can express several redirections at once, based on patterns. For example, a redirection can be used to redirect all the urls of the form
/shop/clothes/product-<INTEGER>.html, with the status code of your choice. Of course, the rules can embed much more complexity based on the requirements you choose to apply.
Under the hood, we use regular expressions to match incoming URLs, but you won't have to write manually these regular expressions. You can instead use our graphical expressions builder, which allow to express complex requirements in a simple way.
Redirection rules creation steps¶
Creating redirection 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 the hit the "Add marker" button, and insert an "integer" marker (name it as you like). In the "target URL" field, you can then use this newly created marker!
- click the "Test impact" button
- 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¶
One you have made several changes to your redirections 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.
- once you have reviewed the changed, 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 dashboard, 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 dashboard, which lists running instances, when they have been updated, and how many rules they are using.