Redirecting without showing the new URL á la [PT]

0

Issue

I have an Apache server running on Linux. On the same host I’m running Xen with Windows Server 2008 + IIS. Windows gets a different IP address.

The host lives behind a NAT and I’ve configured it to direct port 80 to Linux and 8080 to Windows.

Apache offers a virtual host to handle incoming requests but these need to just be redirected to IIS, therefore my rewrite rule can be expressed as follows:

<VirtualHost ...>
ServerName www.firstdomain.com
...
RewriteEngine On
RewriteOptions Inherit
RewriteRule ^/(.*) http://www.seconddomain.com:8080/$1 [R,L]

This works fine since a request for www.seconddomain.com comes into the Apache VH, which rewrites the URL as www.secondomain.com:8080 and thus the browser now lands on IIS.

My question: I don’t want the user to see that the URL changed; I want it to behave the way that the passthrough option for rules works.

How can I accomplish this? And, if rewrite rules is the wrong approach, what is a better one?

Update

I found the [P]roxy flag for rules. This (almost) works great. I can put a file in the root of my IIS and reach it via http://www.seconddomain.com/tst.html – however, references within the document don’t get redirected properly e.g. the <img src='/images/tst.jpg' /> fails, showing there should have been an image in its place… what else do I need?

Solution

ok, it all works. I was just being dumb. the [P] is exactly what I needed.

Answered By – ekkis

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More