2

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 and cap deploy.

Nothing changed in any apache config files or anything outside the root directory of the symfony project. The server root points to symfonyRoot/current/web, 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}]

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

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

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

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

Edit:

from the apache2.conf file:

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

from the virtual host config:

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

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.

11mb
  • 1,339
  • 2
  • 16
  • 33
Erik Verboom
  • 365
  • 3
  • 17
  • Check in your apache2.conf if you have AllowOverride On. This might explain why your .htacess is ignored – ibi0tux Sep 01 '15 at 13:23
  • See the updated question. However, i would be very surprised if the reason is anywhere outside the symfonyroot folder, since it all worked perfectly fine before and that is the only folder i touched. – Erik Verboom Sep 01 '15 at 13:45

1 Answers1

0

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!

Erik Verboom
  • 365
  • 3
  • 17
  • where did u add the option FollowSymLinks i have the same probleme this is my htaccess RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ public/index.php [QSA,L] – Sohaib El Mediouni Feb 08 '21 at 17:15