我在Apache的目录中有几个应用程序。在Apache 2.2中,我对其进行了设置,以便某些路由(包括根路由)进入一个应用程序,而其他所有路由进入另一个应用程序。我刚刚更新到Apache 2.4,并更新了所有设置,但是根请求的RewriteCond似乎不再起作用(这在2.2上肯定可以)。
似乎正在发生的事情是根请求(www.foo.co.uk)的重写条件似乎不再匹配,因此陷入了第二种重写规则,我不希望这样做。对Apache进行过任何更改可能会影响到这一点吗?
<VirtualHost *:80>
ServerAdmin [email protected]
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
原来的问题是我已经在根文件夹中保留了默认的index.html文件。我不确定为什么行为已更改,但是删除此文件会导致重写条件再次正常运行。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句