0

使用 Mod_jk 连接器,我们在 /etc/apache2/sites-available 文件中有这个:

RewriteRule /$ /op_ugw/orderportal/home?switchprofile=RecyledPlants [L] 这工作正常。www.recycledplants.com 将带您到正确的地方。

但是在 Ubuntu 10.04 服务器上,我们设置 ajp 而不是 mod_jk 。所以我们有

ProxyPass / ajp://10.1.1.1:8009/op_ugw/orderportal/home?switchprofile=RecyledPlants ProxyPassReverse / ajp://10.1.1.1:8009/op_ugw/orderportal/home?switchprofile=RecyledPlants

当我尝试访问recycledplants.randrinc.com(用于测试的网址)时,我收到404错误并且

描述:请求的资源 (/op_ugw/orderportal/home%3Fswitchprofile=RecyledPlants) 不可用。

这 ?已转换为 %3F。

有没有办法阻止 Apache 转换 ? 到 %3F。

希望这是有道理的。谢谢安

4

2 回答 2

0

If I understand your question correctly: Add a "NE" to the end of the RewriteRule.

This flag prevents mod_rewrite from applying the usual URI escaping rules to the result of a rewrite. Ordinarily, special characters (such as '%', '$', ';', and so on) will be escaped into their hexcode equivalents ('%25', '%24', and '%3B', respectively); this flag prevents this from happening.

RewriteRule \/$ /op_ugw/orderportal/home?switchprofile=RecyledPlants [L,NE] 

You can read more about how this works in the apache mod_rewrite documentation: http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html

于 2010-12-29T18:26:01.730 回答
0

在 Java Ranch 上得到了一些指示,并且能够弄清楚如何。这是我所做的:好的,这是有效的:

/etc/apache2/sites-available 没有参数/重定向的文件(只是文件的顶部): NameVirtualHost 10.1.1.1:80

ServerAdmin webmaster@localhost

     ServerName ugw.randrinc.com

    DocumentRoot /var/www/ugw/

    ProxyPreserveHost On

    ProxyPass / ajp://10.1.1.1:8009/op_ugw/orderportal/home
    ProxyPassReverse / ajp://10.1.1.1:8009/op_ugw/orderportal/home

    <Proxy *>
      Order deny,allow
      Allow from all
    </Proxy>

<Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
   etc...etc... etc..

这是您需要重定向时的样子,在我的情况下,我正在传递参数并且应用程序执行重定向: NameVirtualHost 10.1.1.1:80

ServerAdmin webmaster@localhost

    ServerName recycledplants.randrinc.com

    DocumentRoot /var/www/recycledplants/

    ProxyPreserveHost On

    ProxyPass / ajp://10.1.1.1:8009
    ProxyPassReverse / ajp://10.1.1.1:8009

    <Proxy *>
      Order deny,allow
      Allow from all
      RewriteEngine On
      RewriteRule \/$ /op_ugw/orderportal/home?switchprofile=RecyledPlants [L]
    </Proxy>
<Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
  etc....etc....etc

希望这可以帮助某人。我也在亚马逊云服务器上的 Ubuntu 10.04 上运行。格式化有点麻烦,但我认为你可以阅读。安

于 2010-09-17T20:01:46.867 回答