# Redirect to Slash plugin

**URL:** <https://forum.getkirby.com/t/redirect-to-slash-plugin/3343>\
**Category:** Plugins\
**Created:** [February 16, 2016, 7:29am UTC](https://forum.getkirby.com/t/redirect-to-slash-plugin/3343 "2016-02-16T07:29:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jenstornell](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jenstornell/32/546_2.png) [@jenstornell](https://forum.getkirby.com/u/jenstornell)\
**Post date:** [February 16, 2016, 7:29am UTC](https://forum.getkirby.com/t/redirect-to-slash-plugin/3343/1 "2016-02-16T07:29:53Z")

</div>

[https://github.com/jenstornell/kirby-redirect-to-slash](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

1. It will ignore the urls for the Panel and the Patterns plugin.
2. It will take the last part of the url and check if it has valid characters.
3. Allowed characters are a-z, 0-9 and slash.
4. If it only have allowed characters it will redirect to slash, else it don’t.
5. If it includes other characters like ? or : it will not be redirected.

## Example

### Example 1

Will redirect:

```auto
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:

```auto
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.

```php
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
