The short story with Symfony 4 virtual host setup and probably outdated
i we just started to learn Symfony and were surprised with not found on just a fresh Apache setup environment.
I followed the tutorials and everything was “Ok” till the moment with routes. There were no problems with the index page, with the index.html.twig too.
But what a surprise with the “rewrited” urls. I got many 404 “Not found” pages until the moment I found a good example of a Apache.conf virtual host. This link: How To Deploy a Symfony Application to Production on Ubuntu 14.04
But i learned Symfony 4, so i had to change the app.php to index.php (default file at the moment) and added: ServerName my-test.vio (virtual host) on top. You can change it with your test server name. And don’t forget to edit your /etc/hosts file.
BTW you can’t use anymore *.dev extension for setup Apache vhosts. Try something like .test, .vhost. Modern is .local
<VirtualHost *:80> ServerName tut-crud.vio DocumentRoot "/var/www/html/tut-crud/public" <Directory /var/www/html/tut-crud/public> AllowOverride None Order Allow,Deny Allow from All <IfModule mod_rewrite.c> Options -MultiViews RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php [QSA,L] </IfModule> </Directory> # uncomment the following lines if you install assets as symlinks # or run into problems when compiling LESS/Sass/CoffeScript assets # <Directory /var/www/project> # Options FollowSymlinks # </Directory> ErrorLog /var/log/apache2/symfony_error.log CustomLog /var/log/apache2/symfony_access.log combined </VirtualHost>
Views: 321