Symfony configuration for Apache

Edit /etc/hosts

127.0.0.1       symfony.io

Add VirtualHost in /etc/apache2/sites-available/symfony.conf


    ServerName symfony.io
    #ServerAlias www.domain.tld

    DocumentRoot /var/www/html/learningSymfony
    
        AllowOverride All
        Order Allow,Deny
        Allow from All

        
            Options -MultiViews
            RewriteEngine On
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteRule ^(.*)$ web/app_dev.php [QSA,L]
        
    

    # uncomment the following lines if you install assets as symlinks
    # or run into problems when compiling LESS/Sass/CoffeeScript assets
    
        Options FollowSymlinks
    

    ErrorLog /var/log/apache2/learningSymfony.log
    CustomLog /var/log/apache2/learningSymfony.log combined

Create symlink to file configuration

ln -s /etc/apache2/sites-available/symfony.conf /etc/apache2/sites-enable/symfony.conf

Enable mod_rewrite in Apache:

sudo a2enmod rewrite

Restart apache:

sudo service apache2 restart

Go!