Steeph
Steeph

Reputation: 3

Symfony 2 removing app.php

i have been through lots of topic about this, and the thing is still not working so i was wondering if you could help me to see what i am doing wrong.

My goal is to have neat URL as www.name.com without the app.php nor web, and i have changed over and over my Virtualhost & Htacces that my page are kind of gone for now^^ (Yeah so pro)

So first, i have enabled the rewrite mod, and i am running a 2.2.2 apache version.

Here is my VirtualHost files :

<VirtualHost *:80>
    ServerName steeph
    ServerAlias name.com

    DocumentRoot /home/ksc/www/symfony/web
    <Directory /home/ksc/www/symfony/web>
        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>

I have also tried with line on :

<Directory "path">
        DirectoryIndex app.php
        Options -Indexes
        AllowOverride All
        Allow from All
</Directory>

which are not working either

For my htaccess i have tried at the symfony files root (and removing the /web from the virtual host) which was a fail, and i tried with this htaccess

<IfModule mod_rewrite.c>
    RedirectMatch permanent ^/app\.php/(.*) /$1
    RewriteEngine On
    RewriteBase /web/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ app.php [QSA,L]
</IfModule>

I tried with the "RedirectMatch permanent ^/app.php/(.*) /$1" and without

So i have been to like a dozen of stackoverflows and i have tried even not popular answer but it still not working, so i would really appreciate some help here

Thanks a lot!

Upvotes: 1

Views: 768

Answers (2)

Cesar Devesa
Cesar Devesa

Reputation: 1277

If Linux... enable Rewrite

sudo a2enmod rewrite

sudo service apache2 restart

Upvotes: 4

Heah
Heah

Reputation: 2379

You could just copy the one from symfony standard edition

-> https://github.com/symfony/symfony-standard/blob/master/web/.htaccess

and it would just work fine.

Upvotes: 0

Related Questions