Level 1
???
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi guys,
How I can create URLs like this using routes
example.com/Jfd9eJFg36 <== I want my download page to be like this
But I don't want to get problems with the other routes like :
example.com/login
example.com/register
example.com/contact
You can define a catch-all route at the end of your routes file so that any hard-coded routes are matched first:
// every other route
Route::get('{hash}', fn ($hash) {
// logic to find file using $hash or abort with `404`
return response()->download() //etc.
})
Please or to participate in this conversation.