asalanka
asalanka

Reputation: 93

Symfony2 cant access app_dev.php unless removing .htacess file in web folder

Symfony2 cant access app_dev.php unless removing .htacess file in web folder, I would appreciate if any one would help me out here thank you in advance.

Content of the .htaccess file:

<IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$ 
    RewriteRule ^(.*) - [E=BASE:%1] 
    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/ # RedirectTemp cannot be used instead 
    </IfModule> 
</IfModule>

Upvotes: 0

Views: 746

Answers (1)

thomas.mc.work
thomas.mc.work

Reputation: 6474

Did you consider the "Configuring a web server" part of the symfony book?

Excerpt:

<VirtualHost *:80>
    ServerName domain.tld
    ServerAlias www.domain.tld

    DocumentRoot /var/www/project/web
    <Directory /var/www/project/web>
        # enable the .htaccess rewrites
        AllowOverride All
        Order allow,deny
        Allow from All
    </Directory>

    ErrorLog /var/log/apache2/project_error.log
    CustomLog /var/log/apache2/project_access.log combined
</VirtualHost>

The AllowOverride All statement is important here. If this is missing then you aren't allowed to define rules in .htaccess files.

Upvotes: 1

Related Questions