Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

151
Views
redirect to 404 page automatically at laravel 5.4

i made simple resume site with laravel 5.4 and i wanna if users type anything except my site name and my site.com/panel automatically redirect to 404 page.

how can i do that?

is there any route to do that or what?

i found this code but not use

 public function render($request, Exception $e)
{
    if ($e instanceof 
    \Symfony\Component\HttpKernel\Exception\NotFoundHttpException){

        return response(redirect(url('/')), 404);
    }
    return parent::render($request, $e);

}
about 4 years ago · Santiago Trujillo
3 answers
Answer question

0

just add abort method

 return abort(404);

it's automatically redirect to your resources/views/errors/404.blade.php

about 4 years ago · Santiago Trujillo Report

0

return abort(404);

and set your routes too for this particular action/method with get request.

about 4 years ago · Santiago Trujillo Report

0

In addition, you may provide the response text:

return abort(403, 'Unauthorized action.');
about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!