Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [Symfony] Problem z routingiem na produkcji
mariusz8801
post 22.06.2022, 12:20:15
Post #1





Grupa: Zarejestrowani
Postów: 8
Pomógł: 0
Dołączył: 17.06.2014

Ostrzeżenie: (0%)
-----


Witam,

Mam problem z routingiem Symfony 6 na produkcji. Metoda index działa, homepage się wyświetla, a nie działają pozostałe, images i videos, które są w tym samym kontrolerze, dostaję 404 Page Not Found. Lokalnie wszystko działa.

Zmieniłem w .env
APP_ENV=prod

do tego
yarn encore production

Prośba o pomoc, czy coś jeszcze muszę ważnego zrobić żeby mi routing zaczął działać produkcyjnie?

Mam Controller:
  1. <?php
  2.  
  3. namespace App\Controller;
  4.  
  5. use Doctrine\Persistence\ManagerRegistry;
  6. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  7. use Symfony\Component\HttpFoundation\Response;
  8. use Symfony\Component\Routing\Annotation\Route;
  9.  
  10. class PageController extends AbstractController
  11. {
  12. #[Route('/', name: 'home')]
  13. public function index(ManagerRegistry $doctrine): Response
  14. {
  15. return $this->render('page/home.html.twig');
  16. }
  17.  
  18. #[Route('/images/{galleryId}', name: 'images')]
  19. public function images(ManagerRegistry $doctrine, $galleryId = null): Response
  20. {
  21. return $this->render('page/images.html.twig');
  22. }
  23.  
  24. #[Route('/videos/{galleryId}', name: 'videos')]
  25. public function videos(ManagerRegistry $doctrine, $galleryId = null): Response
  26. {
  27. return $this->render('page/videos.html.twig');
  28. }
  29. }


routes.yaml
  1. controllers:
  2. resource: ../src/Controller/
  3. type: annotation
  4.  
  5. kernel:
  6. resource: ../src/Kernel.php
  7. type: annotation
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 20.05.2024 - 05:04