0

I need to run the application I wrote with symfony 6 in a subfolder. There will be 2 applications in the same domain. I defined virtual host in .htaccess file but it didn't work. I define rewrite base but it doesn't work. symfony detects the folder name as domain.com/folder route and says route not found.

<VirtualHost *:80>
    DocumentRoot /controlpanel/public

    RewriteEngine On

    RewriteCond %{DOCUMENT_ROOT}/$1 !-f
    RewriteRule ^/controlpanel/(.*)$ /controlpanel/index.php [QSA,L,PT]

    Alias /controlpanel /controlpanel/public

    <Directory /controlpanel/public>

      Options Indexes FollowSymLinks MultiViews
      AllowOverride None
      Order allow,deny
      allow from all
    </Directory>
</VirtualHost>

Can you provide an example htaccess where I can do this. Or will the directoryroot part of the virtual host be the directory where the project is located on the server? I'll be happy if you can help me. thanks

Fabien Papet
  • 2,244
  • 2
  • 25
  • 52
Azad KAYA
  • 29
  • 1
  • 6
  • Please have a look to https://symfony.com/doc/current/setup/web_server_configuration.html#apache-with-mod-php-php-cgi – Fabien Papet May 20 '22 at 10:56
  • it does not work – Azad KAYA May 23 '22 at 10:10
  • I use a lot of apps with symfony, from 4 to 6, without any problems. All running on apache. Please, give some information about your configuration because the problem is how you configured apache. It's not related with symfony at all. – Martin May 26 '22 at 23:47
  • Apache is so flexible that makes things a little bit too much complicated sometimes. On windows I used to work with xampp to develop. But I use Linux since 2016 and all that I do is: create a symlink to /var/www/html/myNewApp. As easy as that. ln -s ~/Work/MySymfonyApp/public /var/www/html/MyApp Then I browse for localhost/MyApp – Martin May 26 '22 at 23:58

0 Answers0