httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Schoenborn <scho...@cae.com>
Subject RE: [users@httpd] best way to modify a URL
Date Wed, 16 Dec 2009 21:43:31 GMT
Sorry I didn't notice the html format, I'm amazed that some people were able to understand
my question! Hopefully it works now. Here is what I am trying to do, 2 separate cases: 

1. Client goes to http://dodo.foo.com: 
  A. server changes this to http://foo.com/bar
  B. server returns content (which will be http://foo.com/bar/index.html)
  C. client sees the content in browser
  D. AND the client's browser shows the URL (in Location text field) as being http://dodo.foo.com
(rather than http://foo.com/bar/index.html)

2. Client clicks on a link that is on the page just received:
  A. the href will be, say, http://foo.com/bar/someotherpage.html
  B. server returns content
  C. client sees the content in browser
  D. AND the client's browser shows the URL (in Location text field) as being http://dodo.foo.com/someotherpage.html
(rather than http://foo.com/bar/someotherpage.html)

I have tried the following, based on Justin's rewrite rule suggestion: 

RewriteEngine on
RewriteCond   %{HTTP_HOST}                 ^dodo\.foo\.com$
RewriteRule   ^(.+)                        %{HTTP_HOST}$1          [C]
RewriteRule   ^dodo\.foo\.com/(.*)    http://foo.com/bar/$1   [R]

This takes care of 1A to 1C but not 1D or 2. For 1D, the Location shows http://foo.com/bar/
rather than the original http://dodo.foo.com. The rewrite log shows the following lines when
requesting http://dodo.foo.com:

192.168.2.1 - - [16/Dec/2009:16:24:50 --0500] [dodo.foo.com/sid#6b5148][rid#18b80b0/initial]
(2) init rewrite engine with requested uri /
192.168.2.1 - - [16/Dec/2009:16:24:50 --0500] [dodo.foo.com/sid#6b5148][rid#18b80b0/initial]
(2) rewrite '/' -> 'dodo.foo.com/'
192.168.2.1 - - [16/Dec/2009:16:24:50 --0500] [dodo.foo.com/sid#6b5148][rid#18b80b0/initial]
(2) rewrite 'dodo.foo.com/' -> 'http://foo.com/bar/'
192.168.2.1 - - [16/Dec/2009:16:24:50 --0500] [dodo.foo.com/sid#6b5148][rid#18b80b0/initial]
(2) explicitly forcing redirect with http://foo.com/bar/
192.168.2.1 - - [16/Dec/2009:16:24:50 --0500] [dodo.foo.com/sid#6b5148][rid#18b80b0/initial]
(1) escaping http://foo.com/bar/ for redirect
192.168.2.1 - - [16/Dec/2009:16:24:50 --0500] [dodo.foo.com/sid#6b5148][rid#18b80b0/initial]
(1) redirect to http://foo.com/bar/ [REDIRECT/302]

I think the problem for 1D might be the redirect. If so, any ideas how to remove that step?
For #2, perhaps a redirect rule? 

Oliver



> -----Original Message-----
> From: André Warnier [mailto:aw@ice-sa.com]
> Sent: December 15, 2009 5:59 PM
> To: users@httpd.apache.org
> Subject: Re: [users@httpd] best way to modify a URL
> 
> Oliver Schoenborn wrote:
> > I have a simple problem:   the URL root for a client website we are
> setting up is http://foo.com/bar/*, but our client wants access to be
> it via http://dodo.foo.com<http://qun.foo.com>/*, how would I set this
> up? I have used mod_proxy in the past for something similar but this
> doesn't seem to be applicable here. I think mod_rewrite could handle it
> but it is rather complicated to learn in short time, if there is a
> simpler way or an example somewhere a link would be greatly
> appreciated. Cheers,
> > Oliver
> >
> >
> Hi.
> Please post your messages to the list (and preferably any list) in
> plain
> text, not in html.
> As it is, your question is not really understandable.  There are 3
> different hostnames mentioned, and it is not very clear what you mean.
> A "URL root" (whatever that really means), certainly never ends in "*".
> Your problem may be simple, but the way you explain it does not make it
> simple to understand.
> Try again ?
> 
> 
> 
> 
> ---------------------------------------------------------------------
> 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


---------------------------------------------------------------------
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


Mime
View raw message