Erik Verboom Erik Verboom - 5 months ago 35
Apache Configuration Question

403 Forbidden error after symfony 2 reinstall

I am building a web app on top of the symfony2 framework. Everything used to work fine until, due to some problems, i had to wipe the production symfony folder clean and reinstall everything inside the symfony project folder.
Now every request to the server returns a 403,

You don't have permission to access / on this server.

Note: the server software is apache2 running on ubuntu.

I deployed using capifony, running
cap deploy:setup
cap deploy

Nothing changed in any apache config files or anything outside the root directory of the symfony project. The server root points to
, the .htaccess file in that directory looks as follows:

DirectoryIndex app.php

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
RewriteRule ^(.*) - [E=BASE:%1]

RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

RewriteRule ^app\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .? - [L]

RewriteRule .? %{ENV:BASE}/app.php [L]

<IfModule !mod_rewrite.c>
<IfModule mod_alias.c>
RedirectMatch 302 ^/$ /app.php/


from the apache2.conf file:

<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted

from the virtual host config:

<Directory "/var/www/SymfonyRoot/current/web">
Require all granted
AllowOverride All
Allow from All
Options None

I am sure that it is just one simple thing that i am forgetting somewhere, but i can't figure out why the server is denying permission to any routes.


So, i figured out what was wrong:

Options FollowSymLinks was not turned on for the /var/www/SymfonyRoot/current/web folder.

just added Options FollowSymLinks to the .htaccess file and everything works like a charm again!