0
votes

I know very little about symfony framework. I copied a website www.example.net to www.example.com site works with url

www.example.com/www/app.php
or even with
www.example.com/www/
but I want it to redirect automatically to app.php without showing it in the url. My htaccess in the www (web) directory is as follows:
&ltIfModule mod_rewrite.c&gt
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ app.php [QSA,L]
&ltIfModule&gt

It doesn't redirect.

Thanks

3
cleared your cache after copying? ;)Nicolai Fröhlich
Yes I'd cleared the cache.Harshad M
shall I put this below RewriteEngine On ?Harshad M
yes otherwise the rule would be ignored if rewrite engine was disabled for your vhost and enabled only by the htaccess file. Add RewriteBase /wwwNicolai Fröhlich
Tried this, but no luck.Harshad M

3 Answers

1
votes

In your Vhost:

Change this line (Directory section):

AllowOverride None

to:

AllowOverride All
0
votes

Instead of that rule can you try:

RewriteBase /www/
RewriteRule ^((?!app\.php).*)$ app.php/$1 [NC,L]

Sorry I can't test with Symphony as I am not near my home computer.

0
votes

A bit late to this game but I just found an Apache directive that saves so much time and makes your htaccess cleaner. The only caveat is you must have Apache 2.2.16+. To have all urls except valid files (images, etc) use app.php as a front controller use the FallbackResource directive.

<Directory "/web/symfony-project">
    FallbackResource /app.php
</Directory>