Install Statamic Redirect from the
Tools > Addonssection of your control panel, or via composer:
composer require rias/statamic-redirect
Redirect allows you to redirect legacy URLs, so that you don't lose SEO value when rebuilding & restructuring a website.
Redirect supports traditional exact and RegEx matching of URL patterns.
Redirect will also automatically create a redirect for you if you change an entry's slug or uri.
Unlike utilizing .htaccess to do redirects, Redirect does not add overhead to each request for each redirect you have in place.
Redirect has no impact on your website's performance until a 404 exception happens.
You can publish the config file using
php artisan vendor:publish --tag=statamic-redirect-config
By default, Statamic Redirect will create error logs, you can disable this by setting the
log_errors config value to
Logging individual hits
By default, Statamic Redirect will also keep individual hits for each error, you can disable this by setting the
log_hits config value to
Create entry redirects
By default, Statamic Redirect will create redirects when the URI of an entry changes. You can disable this by setting the
create_entry_redirects config value to
The amount of errors can grow quickly, Statamic Redirect includes a scheduled command that by default cleans up errors older than 1 month.
You can disable the cleaning by setting the
clean_errors config value to
false. Or change the date range by changing the
clean_older_than config value. This accepts a value that is parsed by PHP's createfromdatestring function.
Make sure your Schedule is running for error cleaning to work.
If you want to use a different storage method for the Errors or Redirects, you can change them in the config file.
These should implement
In the future this addon will come with some extra Repositories by default, without a need to code your own.