Actions reference

Actions reference

Actions are the operations that a rule must perform, and which can be defined in the third step of the rule edition form. This page presents the various action types supported by redirection.io.

Please note that one rule can perform several actions. The actions are performed sequentially - hence you can for example decide to add a custom HTTP response header, inject Structured data in the page and override the HTML "title" and "description" meta tags in one single rule.

Action types list

Redirection

The Redirection action generates a HTTP redirection.

If you are unfamiliar with HTTP redirections, please read first our guide about what is a URL redirection.

You can setup two parameters:

  • the target of the redirection (ie., the URL that the user must be redirected to). This can be a relative or absolute URL (starting with http:// or https://).
  • the status code of the redirection - choose if it must be a permanent or temporary redirection;

Redirection action

When hitting the "Use variable" button, you can reuse a marker that your may have defined in the "Source URL" trigger. This is useful to create dynamic redirection rules, that will use a part of the Source URL in the target location.

"Pro" plan project members can also use any request property in the redirection target URL. It can be:

  • the value of any request header
  • the time of the request
  • the hostname
  • the path of the request
  • the HTTP method that was used
  • the scheme of the requested URL
  • the IP address of the client

This feature can be useful in many cases. For example, it can help create scenarios based on the value of a Cookie or any request header that your CDN could add, etc.

In order to add a header value in the redirection target URL field, proceed with the following steps:

  1. Button to use a request property Hit the "Use variable" button. This will list the markers used during the "Trigger" step, and it also displays the link "Use a request property" - choose this option
  2. Button to use a request property Fill the form in the lateral panel, to select the request property that you would like to inject in the redirection target URL
  3. Button to use a request property Please note that transforms can be used to modify the injected value. For example, you may want to lowercase a header's value, or to perform replacements.
  4. Button to use a request property The property appears in the "Target URL" field

HTTP 404 (Not found)

The HTTP 404 (Not found) action allows to "drop" traffic at the proxy level, by sending a 404 response. If you have recently removed content from your website and want to instruct bots and visitors to stop visiting these urls, this action can be useful and help save traffic on your backend stack.

Of course, you have to be quite careful when using this action, as this will willingly generate HTTP errors!

HTTP 404 action

HTTP 410 (Gone)

The HTTP 410 (Gone) action allows to "drop" traffic at the proxy level, by sending a 410 response. If you have recently removed content from your website and want to instruct bots and visitors to stop visiting these urls, this action can be useful and help save traffic on your backend stack. A 410 status code should be prefered if the page has completely disappeared, and you want to stop search engines from loosing time and resources visiting this page again.

Of course, you have to be quite careful when using this action, as this will willingly generate HTTP errors!

HTTP 410 action

Meta tag override

When creating a website, it is a quite common SEO mistake to forget filling all the <meta> tags. Even optimized websites tend to have duplicates in page titles or description, which is usually not considered a SEO best-practice.

In order to avoid those issues, the SEO override action allows to fine-tune the content of this HTML meta-tags in the HTTP responses sent from your platform.

Consider, for instance, the following HTML page:

<!doctype html>
<html lang=en>
  <head>
    <meta charset=utf-8>
  </head>
  <body>
    <p>Here goes the page content.</p>
  </body>
</html>

Using the SEO override action permits to "fix" the page and inject meta tags:

<!doctype html>
<html lang=en>
  <head>
    <meta charset=utf-8>
    <title>Some unique title for this page</title>
    <meta name="description">Put here a unique description for this page</meta>
    <meta name="keywords">keywords, html, page, example</meta>
  </head>
  <body>
    <p>Here goes the page content.</p>
  </body>
</html>

Meta Tag override action

We support the override of quite an extensive list of meta tags, which should cover most of the requirements.

Custom HTTP Header

Managing the HTTP response is not only a HTML or status code story; the redirection.io proxy can also help you add, delete or change response HTTP headers to the responses sent by your website.

The "Custom HTTP Header" action is a very flexible way to manage the responses sent to your users. It can be used to include custom headers required by your business (X-* headers), to add security headers, fix Content Security Policy Headers for a specific URL, etc.

Custom HTTP header action

As for the URL target of the redirection action, "Pro" plan project members can reuse any request variable in response header values:

Custom HTTP header action using the value of a request property

Custom HTML Code

This very generic action allows to embed the string of your choice at different positions in the HTML response. This can be useful to add a stylesheet, a javascript file, or some code.

Custom HTML code action

Robots.txt management

This action is only available in "Pro" plan projects.

This action can only be used when the "Source URL" is the URL of a robots.txt file, and it allows to serve a custom robots.txt file.

robots.txt management action

The action proposes 3 possibilities:

  • Allow all to allow all the crawlers to access all the pages
  • Block all to prevent all crawlers and robots to explore any page. Keep in mind that in some situations, URLs of your website may still be indexed by search engines, even if they haven't been crawled
  • Custom to define yourself the content that should be served as the robots.txt file of the website.

Configuration

This action is only available in "Pro" plan projects.

The Configuration action is useful to manage the redirection.io module behavior across your website. It allows to enable or disable the redirection.io processing altogether, or can just disable the logging of HTTP requests, which is something you may wan to avoid logging sensitive data.

Configuration action

For example, you may want to disable the redirection.io module on your payment pages. You could also want to disable the logging on your user "change password" pages, etc.

Structured data

The "Structured data" action allows to safely inject schema.org json-ld structured data, for build Rich Snippets in SERP. Structured data is often a misunderstood concept, but it is a very easy and convenient way of helping data automation and improve knowledge sharing. Read our knowledge base article about Structured Data to learn more.

redirection.io offers a free Structured Data Validator, which strictly validates the schema.org data that you would want to include in your website.

Using this action, you can choose from one of the proposed Structured data snippets, adapt it to your needs, and validate that the string going to be inserted in your web pages is valid and will be correctly interpreted by Search Engines.

Structured data action

This page has been updated on April 13th, 2022.
Can't find your answer?