0

I have a web site under Symfony 2 and want to have a basic URL rewrite.

Apache mod rewrite is enabled. Apache has been restarted multiple times.

# a2enmod rewrite
Module rewrite already enabled

Virtual host seems ok

<VirtualHost *:80>
    ServerName mydomain.com
    ServerAlias www.mydomain.com

    DocumentRoot /home/www/mydomain/web
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /home/www/mydomain/web>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

And here's my .htacess

<IfModule mod_rewrite.c>
    RewriteEngine On

    #<IfModule mod_vhost_alias.c>
    #    RewriteBase /
    #</IfModule>

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

But http://mydomain.com/ gives the "index of" page and I have to pass through http://mydomain.com/app.php/ to access my web site.

What am I missing ?!!

4

1 回答 1

1

您需要更改AllowOverride NoneAllowOverride All

当此指令设置为 None 并且 AllowOverrideList 设置为 None 时,.htaccess 文件将被完全忽略。在这种情况下,服务器甚至不会尝试读取文件系统中的 .htaccess 文件。

未指定时,AllowOverrideList设置为None

http://httpd.apache.org/docs/current/mod/core.html#allowoverride

于 2013-05-14T16:36:30.710 回答