distantnative/retour-for-kirby

Advanced redirection management and error tracking for Kirby 3

1.0.0 2019-03-28 21:51 UTC

README

Version Dependency License Donate

Plugin for Kirby 3 adding advanced redirection management and error tracking based on rules supporting wildcards and HTTP status codes. Comes with a Panel view, so redirects can be managed without writing code. Make sure to take your visitors where they are heading.

Commercial usage and support development 💛

Retour is free and under the MIT license. If you use it in a commercial project or you want to support its development in general, please consider to give back by

Screenshots

Screenshots

Installation

Download

Download, unzip and copy this repository to /site/plugins/retour.

Git submodule

git submodule add https://github.com/distantnative/retour-for-kirby.git site/plugins/retour

Composer

composer require distantnative/retour-for-kirby

Redirects

URL pattern

Path to catch via the plugin and redirect. Can use routing patterns, e.g. (:any) or (:all), learn more.

Redirect to

Four options:

  • Relative path inside your own site (e.g. blog/2018/a-nice-story)
  • URL of external website (e.g. https://getkirby.com)
  • error to return your site's error page
  • empty to let the browser request fail (for status codes not in the 3xx range)

If you use routing patterns, the matched parts can be used via numbered variables ($1, $2...): e.g. project/(:any)/photos => project/$1/gallery.

Status

Status codes in the 3xx range will actually redirect the request to the new location (URL changes). All other HTTP status codes have the option to return a specified page with the selected HTTP status code (while the URL stays the same) or let the browser request fail with the selected HTTP status code (if you leave the Redirect to field empty).

Color of the status bubbles

  • #7ea328 Redirects (300-399)
  • #f0c674 Other HTTP status codes
  • #c82829 disabled

HTTP status codes

Tracking

Retour tries to track the times it redirects visitors as well as the times visitors try to visit a page on your site that does not exist (typically when they get a 404 error or your site's error page shown).

To maintain privacy and collect the least data necessary, Reroute does not log any personal data of the visitor (no IP etc.). Only the target URL, the referrer and the time are stored in an agregated way.

The tracked hits are displayed in the Panel with a blue status bublle, indicating whether a redirect route or 404 path has been visited #4271ae recently or #ccc not so recently.

Permissions

Access

title: Editor

permissions:
  access:
    retour: false

Update

title: Editor

permissions:
  site:
    update: false

Known issues

Custom folder setup

If you are using a custom folder setup for Kirby, there might be issues with where the Retour plugin is trying to store its config and log files. If you have issues and questions in this regard, please get in touch.

Disclaimer

This plugin is provided "as is" with no guarantee. Use it at your own risk and always test it yourself before using it in a production environment. If you encounter any problem, please create an issue.

Credits

Thanks to @sylvainjule and @pedroborges for their help in translating and styling the plugin.

License

MIT

It is discouraged to use this plugin in any project that promotes racism, sexism, homophobia, animal abuse, violence or any other form of hate speech.