A
A
Alexey Gus2021-04-23 12:27:46
linux
Alexey Gus, 2021-04-23 12:27:46

Symfony 5 + Apache2 why apache can't see all pages except "/"?

The crux of the matter is what. I started the server under Linux on Apache2, configured the configs all fire, the main page along the path ("/") is loaded, all content is loaded, but when redirecting or switching to another link (ala ".../ru/" Apache does not see it. Although when starting a local server, the symphony is all fire ... where is the jamb in what configs?

here is a piece of the controller responsible for the redirect

/**
     * @Route("/", name="en")
     * @param Request $request
     * @return RedirectResponse|Response
     */
    public function indexLocale(Request $request): Response
    {
        dump($request->getLocale());
        return $this->redirect('/ru');
    }

    /**
     * @Route("/{_locale}", name="main")
     * @param Request $request
     * @return RedirectResponse|Response
     */
    public function index(Request $request , MailerInterface $mailer): Response
    {
        dump($request->getLocale());
....\\отальной код


here is the apache config
<VirtualHost *:80>
  ServerAdmin [email protected]
  DocumentRoot /mnt/64D09FE0D09FB6B0/Users/Note/Desktop/simfony/simpleProject/public
    <Directory "/mnt/64D09FE0D09FB6B0/Users/Note/Desktop/simfony/simpleProject/public">
            Options FollowSymLinks
      AllowOverride All
      Require all granted
    </Directory>
  ErrorLog ${APACHE_LOG_DIR}/error.log
  CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>


.htaccess content
DirectoryIndex index.php
<IfModule mod_negotiation.c>
    Options -MultiViews
</IfModule>

<IfModule mod_rewrite.c>
    Options -MultiViews
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>

<IfModule !mod_rewrite.c>
    <IfModule mod_alias.c>
        RedirectMatch 302 ^/$ /index.php/
    </IfModule>
</IfModule>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya Loopashko, 2021-04-23
@Holyboom

It seems that there should be .htaccess. Here is the link

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question