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

Hello,

I try to put my project online on my webserver but for the moment I have to enter urls like mywebsite.com/web/... and I'd like to have something like
mywebsite.com/page 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]
</IfModule>

and put it in my documentroot directory but it doesnt work. When I enter mywebsite.com/config.php for example I have an 404 error message but if I enter mywebsite.com/web/config.php it works.

How can make the redirection? thanks for your help.
skandaboy
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

Hi,

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)

cheers
Tiago Garcia
@tiagojsag

Core Web Developer @ Shopware
http://www.shopware.de
User avatar
tiagojsag
Faithful Member
 
Posts: 885
Joined: Wed Aug 10, 2011 4:58 pm