# Route pattern to match all except assets

**URL:** <https://forum.getkirby.com/t/route-pattern-to-match-all-except-assets/8481>\
**Category:** Questions\
**Tags:** v2\
**Created:** [September 12, 2017, 8:39am UTC](https://forum.getkirby.com/t/route-pattern-to-match-all-except-assets/8481 "2017-09-12T08:39:51Z")\
**Posts on this page:** 2\
**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:** [September 12, 2017, 8:39am UTC](https://forum.getkirby.com/t/route-pattern-to-match-all-except-assets/8481/1 "2017-09-12T08:39:51Z")

</div>

I have a route that matches everything. It’s placed after all the other routes to catch unmatched pages, which will then visit the error page.

```php
// All kind of routes

// Catch unmatched and visit the error page
$kirby->set('route', [
	'pattern' => '(.+)',
	'action' => function() {
		return site()->visit( site()->errorPage() );
	}
]);

```

I really like this approach, because nothing will slip through unless I have routes for it. However, it also prevent the plugin assets to work. How can I fix it?

**Match all**

`(.+)`

**Except**

`*assets/plugins/*`

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [February 6, 2025, 5:32pm UTC](https://forum.getkirby.com/t/route-pattern-to-match-all-except-assets/8481/2 "2025-02-06T17:32:09Z")

</div>

Archived on February 6, 2025, 5:32pm UTC


