Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

404 not found when navigate by route on symfony

When i navigate on route i can’t see my page web , i has just get 404 not found

# config/routes/attributes.yaml 
controllers: 
  resource: ../../src/Controller/ 
  type: attribute 
kernel: 
  resource: ../../src/Kernel.php 
  type: attribute``` 

# Controller 

namespace App\Controller; 
use Symfony\Component\HttpFoundation\Response; 
class LuckyController { 
  #[Route('/lucky/number')] 
  public function number(): Response { 
    $number = random_int(0, 100); 
    return $this->render('lucky/number.html.twig', [ 'number' => $number, ]); } }

# Twig (not relevant to question)

{# templates/lucky/number.html.twig #} 
<h1>Your lucky number is {{ number }}</h1>

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I think you are need .htaccess for rewrite url , install apache-patch , and it will take care of the config and adding htaccess.

Install apache pack

composer require symfony/apache-pack
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading