Project

General

Profile

[Solved] Redirect passing full url on querystring

Added by adamm over 9 years ago

I'm struggling to find a way to capture the complete url to pass as part of a redirect
I have resorted to hardcoding the scheme to http with the following

$SERVER["socket"] == ":82" {

$HTTP["host"] =~ "([^:/]+)" {
url.redirect = ( "(.*)" => "http://newdomain.com/?dst=http://%0$1" )
}
}

Is there a better way to retreive the entire url?

Thanks
Adam


Replies (2)

RE: [Solved] Redirect passing full url on querystring - Added by gstrauss almost 7 years ago

brute force method suggested above:

$HTTP["scheme"] == "http" {
  $HTTP["host"] =~ "([^:/]+)" {
        url.redirect = ( "(.*)" => "http://newdomain.com/?dst=http://%0$1" )
  }
} else $HTTP["scheme"] == "https" {
  $HTTP["host"] =~ "([^:/]+)" {
        url.redirect = ( "(.*)" => "http://newdomain.com/?dst=https://%0$1" )
  }
}

    (1-2/2)