marlonpd
3/9/2020 - 5:01 AM

Setup Symfony Site

First you need to do two things:

You need to check if php rewrite module is enabled. you can do it with phpinfo(). Write this in a file info.php and open in browser: http://localhost/info.php

Now search for mod_rewrite. If you see mod_rewrite in this page that means, mod_rewrite is enabled.

If mod_rewrite is not enabled, enable it. I enabled in in ubuntu 18.04 for apache with this command: $ sudo a2enmod rewrite. Then restart apache2 $ systemctl restart apache2
if mod_rewrite is enabled, then other configuration will work.
Then add AllowOverride All in .conf file:

<Directory /var/www/project/public>
    AllowOverride All
</Directory>
Then add .htaccess file in you project root directory.

<IfModule mod_rewrite.c>
    RewriteEngine On

    # Send would-be 404 requests to Craft
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule (.+) index.php?p=$1 [QSA,L]
</IfModule>
Note: Try adding .htaccess file in /var/www/project/.htaccess or in /var/www/project/public/.htaccess. Not sure what will work.