httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Owen Boyle <>
Subject Re: Web Redirection
Date Fri, 19 Apr 2002 11:00:19 GMT
Diye Wariebi wrote:
> I am trying to redirect a site as below
> When you type in I want the user to be redirected
> to but I want their browser to still show
> I am doing this using rewriterule in the virtual host section as below
> RewriteEngine on
> RewriteRule /(.*)$1 [R]
> The redirection is working but I cannot keep the original URL showing.
> Can anyone help please?  Is this possible?

Think about it. Re-direct means to send someone to another site. To do
this, you have to tell the browser the URL of the new site and so it
will display it. What happens is:

Server: 301 ->
Client: Ok, (changes URL in location window)

This is different from rewriting which is used *within* one site and
allows you to serve up page XYZ when the user requests page ABC. This is
hidden from the user (i.e. the browser doesn't change) because the
swapping is happening on the server-side and so the client is unaware of
it. e.g. 

RewriteRule /banana.html /kiwi.html

Server: he asked for banana.html, I'll send him kiwi.html
Client: displays page (still thinks it's called banana.html)

Confusingly, RewriteRule allows you to do plain rewrites like ABC -> XYZ
*and* real redirects (using the [R] flag as you have done above). Note
that anytime you change hosts, you cause a redirect so it is not
possible hide a change of hosts from the client. This is true even if
domain and new-site are on the same server.

It occurs to me that there is a hacky way you could emulate this *if*
both sites were on the same server - you'd have to place the content of
new-site under domain's document root then rewrite requests for pages
under domain into requests for new-site pages... bit messy and not
really what you want.


Owen Boyle.

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message