Installing Symfony2 is quite easy: Just download your favorite package, unpack it, create a new virtual host and you’re ready to go. And if you want to get rid of app.php or app_dev.php in your URLs the package comes with an .htaccess-file in the web/-directory. But the manual doesn’t give you a clou how the virtual host-configuration should be.
A minimal virtual host-definition looks like:
<VirtualHost *:80> ServerName myproject.local DocumentRoot /your/path/to/symfony2/web </VirtualHost>
This works fine except you won’t get rid of app.php/app_dev.php as the .htaccess is silently ignored. Atleast that was the case in my apache installation coming from MacPorts.
You need to enable some directives to be able to use the .htaccess. The extended definition of the virtual host looks like:
<VirtualHost *:80> ServerName myproject.local DocumentRoot /your/path/to/symfony2/web <Directory "/your/path/to/symfony2/web"> Options All Order allow,deny AllowOverride All Allow from all </Directory> </VirtualHost>
After saving the configuration and restarting Apache, you can remove app.php/app_dev.php from the URL.
Enjoy the result.
0 Responses to “Symfony 2: Apache vHost-configuration for OSX”