Manish Basdeo
Manish Basdeo

Reputation: 6269

Why url rewrite is not working in symfony 2?

I want to have a user friendly url such as "http://localhost/Symfony/web/app_dev/" instead of "http://localhost/Symfony/web/app_dev.php/" . I have tried editing the htaccess but still does not work. My htaccess in the web dir is :

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

I suppose it should have worked.. How can I make this work and what is the problem in the htaccess codes if any?

Upvotes: 0

Views: 1041

Answers (3)

Electronick
Electronick

Reputation: 1122

Try to add into your vhost configuration following lines:

<Directory "/path/to/docroot">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

Upvotes: 1

Max Małecki
Max Małecki

Reputation: 1702

You must enable the RewriteEngine in the apache configuration:

sudo a2enmodule rewrite

Regards, Max

Upvotes: 0

xdazz
xdazz

Reputation: 160843

Try adding RewriteRule ^app_dev(.*)$ app_dev.php [QSA,L] before RewriteRule ^(.*)$ app.php [QSA,L].

Upvotes: 0

Related Questions