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:

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

It doesn't redirect.

Thanks

11
  • cleared your cache after copying? ;) Commented Sep 28, 2013 at 13:07
  • Yes I'd cleared the cache. Commented Sep 28, 2013 at 13:10
  • shall I put this below RewriteEngine On ? Commented Sep 28, 2013 at 13:12
  • yes otherwise the rule would be ignored if rewrite engine was disabled for your vhost and enabled only by the htaccess file. Add RewriteBase /www Commented Sep 28, 2013 at 13:15
  • Tried this, but no luck. Commented Sep 28, 2013 at 13:16

3 Answers 3

1

In your Vhost:

Change this line (Directory section):

AllowOverride None

to:

AllowOverride All
Sign up to request clarification or add additional context in comments.

Comments

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.

3 Comments

still not redirecting.
jeah it's the way to make it work if you want to run symfony but keep the subdirectory in the url - he just copied my comment :)
@HarshadManjre: What is DOCUMENT_ROOT value?
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>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.