Документация InstantCMS

для администраторов и разработчиков

Инструменты пользователя

Инструменты сайта


en:manual:components:redirect

Redirects component

Control PanelComponentsRedirects

Description

The component implements the handling of external links through the CMS intermediate page:

  /redirect?url=http://site.ru

Such links you can either write them yourself or enable their automatic generation (all direct links will be replaced by links through the specified redirect) in the fields of content types, for example in the «HTML Text» field.

Also, the component supports rules for redirect and address substitution for internal links.

Settings

List of domains for direct redirect

This field contains a list of domains in domain.com format, each on a new line. Jumps on links of these domains will be carried out without intermediate pages, but immediately will be redirected.

Black list of domains

Also a list of domains in domain.com format, each on a new line. Clicks on links containing these domains will always be blocked.

For all other links, if this checkbox is enabled, links will be verified using the open method of VK. At the same time short links are dereferenced and checked and if the link is suspicious, a warning will be shown to the user. In this case the auto-timer will not work, but it will still be possible to follow the link.

White list of domains

This field contains a list of domains in domain.com format, each on a new line. Links containing listed domains will not be checked according to the «Check links» option and will be shown a normal redirect page without any warning.

Specifies the number of seconds the engine will skip before performing a redirect. The countdown will be shown on the intermediate redirect page. The user will still be able to click on the redirect link without waiting for it to end.

Check HTTP referer

If this option is enabled then CMS will check HTTP referer before creating the redirect page. If the page is opened from a third-party site (and not from your current one), a 404 error will be shown. Thus, all redirect links will only work from your site.

Rules for redirect and address spoofing

In this field you can write JSON code of rules. The format is:

[
    {
        "source": "#^download.html$#i",
        "target": "/get",
        "action": "redirect-301"
    },
    {
        "source": "#^catalog(.*)$#i",
        "target": "https://addons.instantcms.ru/",
        "action": "redirect"
    },
    {
        "source": "#^rss\/blogs\/all\/feed.rss$#i",
        "target": "rss/feed/blogs",
        "action": "rewrite"
    }
]
  • In the source cell of each object you write a regular expression to find a match in the current URI;
  • Cell target - URI for redirection, if source matches;
  • In the cell action - action: rewrite (internal address swapping), redirect (normal redirect), redirect-301 (301 redirect).

In this example, the address /download.html will be redirected 301 to the /get page. An address that starts with /catalog will be redirected with a 301 redirect to https://addons.instantcms.ru/. The address /rss/blogs/all/feed.rss will be handled by an internal spoof and the controller rss with action feed and the blogs action parameter will be called.


Back to components

en/manual/components/redirect.txt · Последнее изменение: 11.08.2022 19:53 — fuze