https://github.com/jenstornell/kirby-redirect-to-slash
I just copy paste the readme-file in here…
Redirect to Slash
In Kirby CMS it redirects every page to urls with slashes.
Why you need it
Maybe you already know but here are some cases:
- You migrate to Kirby from WordPress and want to keep the url structure.
- You migrate to Kirby from anoter CMS and want to keep the url structure.
- You simply like it better.
How it works
- It will ignore the urls for the Panel and the Patterns plugin.
- It will take the last part of the url and check if it has valid characters.
- Allowed characters are a-z, 0-9 and slash.
- If it only have allowed characters it will redirect to slash, else it don’t.
- If it includes other characters like ? or : it will not be redirected.
Example
Example 1
Will redirect:
http://example.com/my-page/my-subpage
http://example.com/my-page/my-subpage/
Example 2
Will not redirect because of characters that are not allowed:
http://example.com/my-page/my-subpage?token=hello
http://example.com/my-page/my-subpage?token=hello
Options
If you have the panel or the patterns plugin in a different location you can change it here. Below are the defaults.
c::set('redirect.to.slash.panel.uri', 'panel');
c::set('redirect.to.slash.patterns.uri', 'patterns');
Known issues
- It does not check if it’s a page before the redirect. WordPress has the same issue.
License
MIT