You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Melanie Pfefer <me...@yahoo.co.uk> on 2007/12/20 10:37:42 UTC

[users@httpd] URL redirection

Hello,

Could you please advise if this can be done in apache?

http://server1/OpenObject?doc=ERW
to be redirected to:

http://server2:9000/OpenObject?doc=ERW

I mean everything that starts with /OpenObject to be
redirected to server2:9000 with the same trailing
string /OpenObject?doc=ERW or /OpenObject?doc=ERW1
…etc.

I am using apache 2.2.4

thanks


      ___________________________________________________________
Support the World Aids Awareness campaign this month with Yahoo! For Good http://uk.promotions.yahoo.com/forgood/

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] URL redirection

Posted by Severin Gehwolf <Se...@uibk.ac.at>.
ups...

> RewriteEngine On
> RewriteRule ^/(OpenObject.*) http://server2:9000/$1 [P,L]
> ProxyPassReverse / http://server1/

of course the ProxyPassReverse directive should look like

ProxyPassReverse / http://server2:9000/

---
severin


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] URL redirection

Posted by Severin Gehwolf <Se...@uibk.ac.at>.
Hi!

> Could you please advise if this can be done in apache?
> http://server1/OpenObject?doc=ERW
> to be redirected to:
> http://server2:9000/OpenObject?doc=ERW
> I mean everything that starts with /OpenObject to be
> redirected to server2:9000 with the same trailing
> string /OpenObject?doc=ERW or /OpenObject?doc=ERW1
> …etc.

In your httpd configuration of "server1" put the following (have
mod_rewrite, mod_proxy and mod_proxy_http loaded). I assume you would
like to have it transparent for the user. Therefore I suggest proxying
the requests like so:

RewriteEngine On
RewriteRule ^/(OpenObject.*) http://server2:9000/$1 [P,L]
ProxyPassReverse / http://server1/

or just by permanent (cachable) redirect (no mod_proxy needed):

RewriteEngine On
RewriteRule ^/(OpenObject.*) http://server2:9000/$1 [R=301,L]

---
severin


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org