Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [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
Salvation
post 22.06.2022, 13:37:48
Post #2





Grupa: Zarejestrowani
Postów: 342
Pomógł: 70
Dołączył: 15.07.2014

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


Doinstalowałes apache-pack?
https://symfony.com/doc/current/setup/web_s...figuration.html
Go to the top of the page
+Quote Post
mariusz8801
post 23.06.2022, 09:45:46
Post #3





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

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


Instalowałem apache-pack ale miałem już plik .htaccess i wtedy on nie ingeruje w niego
Odinstalowałem apache-pack, usunąłem plik .htaccess i zainstalowałem jeszcze raz apache-pack, wtedy on utworzył swój plik .htaccess i jest ok
Go to the top of the page
+Quote Post

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: 19.04.2024 - 04:49