Cindy_127211
Aug 16, 2006Nimbostratus
Rewriting Hostname & URI on HTTP_Request without a 'redirect'
I would like to 'rewrite' the following hostname/uri:
http://www.website1.com/index.php?cid=1234
to
http://www.website2.com/app1/index.php?cid=1234
without using a 'redirect'. It is important on this 'rewrite' that the variable information (cid=1234) get carried over. However, I've only been able to do this with a 'redirect'. I'd prefer to just 'rewrite' the hostname/url;however, as the application code resides on the same server.
How can I make a 'rewrite' (versus a redirect) work in this scenario? Also, I 'threw' in the HTTP::header replace HOST statement...but, don't know if it is really needed.
when HTTP_REQUEST {
if {[HTTP::uri] starts_with "/index.php"} {
set newuri "/livestrongportfolios[HTTP::uri]"
set newhost "www.americancentury.com"
HTTP::header replace HOST $newhost
HTTP::redirect "http://$newhost$newuri"
}
else {
HTTP::redirect "https://[HTTP::host][HTTP::uri]"
}
}