0

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

Harshad M
  • 363
  • 4
  • 21

3 Answers3

1

In your Vhost:

Change this line (Directory section):

AllowOverride None

to:

AllowOverride All
Tanguy Bernard
  • 274
  • 5
  • 15
0

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.

anubhava
  • 761,203
  • 64
  • 569
  • 643
0

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>
John the Ripper
  • 2,389
  • 4
  • 35
  • 61