mod_rewrite不添加REDIRECT_URL环境variables

我们运行一个基于Zend框架的站点,使用Apache httpd(2.2)和mod_rewrite进行SEO和可用性友好的URL:s。 最近我们添加了mod_proxy (和mod_proxy_balancer, mod_proxy_http, mod_rpaf )来设置负载均衡器虚拟主机

我们的设置现在看起来像:

 external.site.com (vhost on server1.site.com with reverse proxy) |-internal1.site.com (vhost on server1.site.com) |-internal2.site.com (vhost on server2.site.com) 

其中internal1internal2服务大部分dynamic内容, external服务静态内容加上一些pipe理员types页面。 所有的虚拟主机都有相同的代码和.htaccess设置。

问题是,在external.site.com RewriteRule不会正确的头添加到请求环境,特别是我们和ZendFramework依赖的REDIRECT_URL 。 一切工作正常转发给内部虚拟主机的请求。

httpd.conf的相关部分:

 <VirtualHost *:80> ServerName external.site.com DocumentRoot /opt/www/htdocs/ CustomLog "/var/log/httpd-proxy-access.log" combined <Proxy balancer://backend/> Balancermember http://internal1.site.com Balancermember http://internal2.site.com ProxySet lbmethod=byrequests </Proxy> ProxyRequests Off <Proxy *> Order deny,allow Allow from all </Proxy> ProxyPass /static/ ! ProxyPass /config/ ! ProxyPass / balancer://backend/ ProxyPassReverse / balancer://backend/ </VirtualHost> <VirtualHost *:80> ServerName internal1.site.com RPAFenable On RPAFproxy_ips 127.0.0.1 </VirtualHost> 

.htaccess文件中:

 RewriteEngine on RewriteCond %{REQUEST_URI} !^.*robots.txt RewriteCond %{REQUEST_URI} !^.*/static/.* RewriteRule .* index.php [L] php_flag magic_quotes_gpc off php_flag register_globals off 

因为在external虚拟主机上只有一个问题,我们认为这是mod_proxymod_rewrite组合的问题。 有任何想法吗?

问候

我绝不是专家,但我必须把[OR]放到我的档案中。 如上所述

 RewriteEngine on RewriteCond %{REQUEST_URI} !^.*robots.txt [OR] RewriteCond %{REQUEST_URI} !^.*/static/.* RewriteRule .* index.php [L] 

我不知道这是否适用于您的应用程序,但不能使用$_SERVER["REQUEST_URI"]的内容吗?

你有没有试过类似的东西:

 RewriteRule .* index.php [L,E=REQUEST_URL:$ENV{'REQUEST_URL'}] 

基本上这个想法是从一个环境中捡起来,然后把它铲到下一个环境。 不知道这会工作,但不能伤害尝试。

我相信我们通过升级Zend Framework来解决这个问题,后来的版本不依赖于REQUEST_URL。 看来REQUEST_URL具有不同的行为,具体取决于安装了哪些模块。 看到这个邮件列表线程