Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR improves the redirect router. It adds support for callback based routing alongside pattern based routing which was already possible.
Redirect routing is available globally, redirects can be setup outside of the context of Pages for any url on your Joomla site
Global redirects
The changes implemented as part of #344 make it possible to implement redirects in Joomla outside of the context of Pages.
Global configuration
You do not need to setup a
/joomlatools-pages
folder to be able to define redirects. If you just want to use this feature add aconfiguration-pages.php
to your Joomla root, and defines your redirects.Configure caching
You can configure the redirect cache lifetime through the
cache
query parameter in the route target. It will set themax-age
value for the Cache-Control header when the response is send.The cache parameters offers support for English textual relative datetime formats as supported by strtotime, for example:
See also: joomlatools/joomlatools-framework#373
For example, set the cache lifetime to 1day
>> '/articles/[:alias]' => '/blog/posts/[:alias]/?cache=1day,