Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
465 views
in Technique[技术] by (71.8m points)

symfony - RewriteRule in Apache with Symfony2 not removing app.php

I have the following .htaccess file in my web directory for my Symfony2 installation:

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

However, when I try something basic such as:

(whatever)/web/app.php/place

it doesn't removing the app.php from the URL. I'm new to Apache and I'm not sure what's going on here, can anyone shed some light? Thanks in advance!

EDIT: Due to the structure of the web app I am working with I cannot move app.php or app_dev.php outside of the web folder nor can I modify the server configuration of Apache in anyway, thus I am looking for an alternative solution to this problem.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You must enable the rewrite module in Apache, as the "IfModule mod_rewrite.c" states.

To do so:

  1. Run command-line command "a2enmod rewrite".
  2. Change all "AllowOverride None" lines to "AllowOverride All".

See http://www.lavluda.com/2007/07/15/how-to-enable-mod_rewrite-in-apache22-debian/.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...