17andLearning
17andLearning

Reputation: 477

Route to default not found 'catch all' address

I'm trying to route URLs like stats/non-existent-page to a default 'not found' page, where I'd like to display a 'Did you mean' suggestion along with a not found message, how can I route all non-existent URLs to a default controller/action?

Upvotes: 1

Views: 335

Answers (1)

Rahul garg
Rahul garg

Reputation: 9362

Something like:

match 'stats/*path' => 'default#non_existent'

Add this after your other 'stats/..' urls , This will route your all stats/* paths to the controller action mentioned with path variable you can use to determine your 'did you mean' suggestion..

Upvotes: 3

Related Questions