This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

Configuring .htaccess to show correct urls

Discuss installing Symfony 2 here

Configuring .htaccess to show correct urls

by skandaboy » Sun Jul 14, 2013 3:46 pm


I try to put my project online on my webserver but for the moment I have to enter urls like and I'd like to have something like without the web/app_php or app_dev.php inside the urls.

I change the .htaccess file to

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

and put it in my documentroot directory but it doesnt work. When I enter for example I have an 404 error message but if I enter it works.

How can make the redirection? thanks for your help.
Junior Member
Posts: 29
Joined: Mon Aug 08, 2011 2:17 pm

Re: Configuring .htaccess to show correct urls

by tiagojsag » Mon Jul 15, 2013 4:11 pm


Make sure you have mod_rewrite enabled. Also, if you can, change your apache (vhost) DocumentRoot to (...)/web/. Then you should just need to use the default Symfony .htaccess and the magic should happen by itself. If not, your htaccess should do the trick (I haven't tested it, but looks similar to mine)

Tiago Garcia

Core Web Developer @ Shopware
User avatar
Faithful Member
Posts: 885
Joined: Wed Aug 10, 2011 4:58 pm