Wild Card or Catch all for routes


I’m using the new slim v3 and I’m not sure how to create a catch all at the end. For example if someone calls mysite.org/oops or mysite.org/notfound. I want to redirect it somewhere specific but not treat it like a 404…

Is there a way of doing this?

You can do this with a regex. checkout the slim docs.

You could also replace the default not found handler to let it do whatever you want.

You choose which method you prefer

1 Like