• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 818
  • Last Modified:

Redirect traffic from Subfolder to different Webserver

Hello!
We have two different webserver (webserver1 running Win2000 and webserver 2 running Ubuntu with apache2) which are both hosting a website. We would like to rewrite a subfolder on webserver 1 (webserver1/wiki/) to redirect all traffic to webserver2.
We tried to use ISAPI_Rewrite with the following code:
RewriteProxy wiki(.*) http\://webserver2$1

Unfortunately, the application running on webserver2 is using absolute paths for their links, so webserver1/wiki/index.php contains links like: /index.php?title=&
When clicking on such a link, the user receives a 404  FileNotFound as http://webserver1/index.php?title=... does not exist.
The thing we would need is either to insert /wiki in front of all these links or to make them relative. Any ideas?
What would be the best approach? Are there alternatives to ISAPI_Rewrite?
Thanks a lot!
Tobias
0
tobiasroedig
Asked:
tobiasroedig
1 Solution
 
adworldmediaCTOCommented:
Have you thought of using a redirect script on the default.htm or index.htm page in that folder that will redirect the client browser to the new location?

You can find an excellent redirect script at http://www.dynamicdrive.com/dynamicindex9/bredirect.htm 

-Joe
0
 
tobiasroedigAuthor Commented:
But then the address would change to http://webserver2/index.php?title=... but it should be http://webserver1/wiki/index.php?title=...
0
 
samriCommented:
on webserver1 (OS Win2K).  What is the webserver running on this machine?  IIS? or Apache.

If it is running some version of Apache, you could look at Apache reverse proxy implementation.

http://httpd.apache.org/docs/2.2/mod/mod_proxy.html

Specifically, look at ProxyPass and ProxyPassReverse directives.
- http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypass
- http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypassreverse

For example, you need to load the proxy module, and add the following directives

ProxyPass                    /wiki               http://webserver2.domain.com/wiki/
ProxyPassReverse       /wiki               http://webserver2.domain.com/wiki/

Alternately, you could look at mod_rewrite to rewrite the URL.

With ProxyPass and mod_rewrite, the URL would not changed, so the client should stay at http://webserver1.domain.com/

If it's running IIS -- :( I am not that well verse with IIS.

cheeers.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now