You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Kevin Luff <ke...@hansard.com> on 2003/01/17 12:49:41 UTC

[users@httpd] Help with Rewrite please....

All,
I've been trying to get a rewrite done for my server which is setup as a reverse proxy and
with SSL
I have the url:
https://xhost.xdomain.com/en/mail.html?sid=9XMPCQHHAyw&lang=en&host=http://ihost.in.idomain.com/&cert=false

returned to my user - but I need to change the 'host=ihost.in.idomain.com/' bit to:
host=https://xhost.xdomain.com/
while leaving everthing else unchanged.

Can someone please show me how before I go mad

TIA

Kevin.
Apache is 1.3.27
mod_SSL is 2.8





Re: [users@httpd] Help with Rewrite please....

Posted by Nelson Goforth <ng...@earthnet.net>.
I finally had some luck with Rewrite, so I'll try this.  It seemed to  
make so much more sense once I actually got it to work just once.

Is 'xhost.xdomain.com' always the same (not a variable)?

You need a regular expression that captures everything from the "/" up  
to the string "host=" between parenthesis, and then everything after  
the next ampersand in another parenthesis, then feed it back with the  
$1 and $2 substitutions.  The following regex WONT work, but it's where  
I'd start to look at the idea while consulting a book, and maybe trying  
the regex on a command line or something.

     RewriteRule    ^(.+host=).+&?(.+)    $1https://xhost.xdomain.com&$2

This is probably a pretty naive regex, but it's a starting point - it  
actually worked for me (mostly) when I tried it in BBEdit.  Everything  
from the beginning up to the "host=" is held in the first memory  
postion, then everything after the next "/&" is held in the second.

Nelson

On Friday, January 17, 2003, at 04:49  AM, Kevin Luff wrote:

> All,
> I've been trying to get a rewrite done for my server which is setup as  
> a reverse proxy and
> with SSL
> I have the url:
> https://xhost.xdomain.com/en/ 
> mail.html?sid=9XMPCQHHAyw&lang=en&host=http://ihost.in.idomain.com/ 
> &cert=false
>
> returned to my user - but I need to change the  
> 'host=ihost.in.idomain.com/' bit to:
> host=https://xhost.xdomain.com/
> while leaving everthing else unchanged.


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