升级到2.4.6后,Apache RewriteCond for root不再工作

时间:2013-11-12 16:36:56

标签: apache mod-rewrite url-rewriting

我有几个应用程序位于Apache的目录中。在Apache 2.2中我设置了它,以便一些路由(包括根路由)转到一个应用程序,所有其他路由转到另一个应用程序。我刚刚更新到Apache 2.4并更新了我的所有设置,但是根请求的RewriteCond似乎不再起作用(这绝对是2.2)。

似乎正在发生的事情是根请求的重写条件(www.foo.co.uk)似乎不再匹配,因此正在进入第二次重写规则,我不希望它。 Apache是​​否有任何可能影响此变化的变化?

<VirtualHost *:80>
ServerAdmin foo@bar.co.uk
ServerName www.foo.co.uk

DocumentRoot /var/www/

<Directory /var/www/>
    Options FollowSymLinks -Indexes
    AllowOverride All

    Order allow,deny
    Allow from all

    RewriteEngine On

    RewriteCond %{REQUEST_URI} ^/$                    [NC,OR]
    RewriteCond %{REQUEST_URI} ^/css                  [NC,OR]
    //various other RewriteCond's
    RewriteCond %{REQUEST_URI} ^/robots.txt           [NC]
    RewriteRule (.*) firstWebApp/public/$1 [PT,L]

    # All other URLs should go to the Other application
    RewriteRule (.*) otherWebApp/$1 [PT,L]
</Directory>

LogLevel warn
ErrorLog syslog:local1

1 个答案:

答案 0 :(得分:1)

原来问题是我在根文件夹中保留了默认的index.html文件。我不确定为什么行为发生了变化,但删除此文件会导致重写条件再次正常工作。

相关问题