httrack follow redirects httrack follow redirects unix unix

httrack follow redirects


On main httrack forum one of developers said that it's not possible.

Proper solution is to use another web mirroring tool.


You could use this script to determine first the real target url and then run httrack against that url :

function getCorrectUrl($url) {    $ch = curl_init();    curl_setopt($ch, CURLOPT_HEADER, true);    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);    curl_setopt($ch, CURLOPT_URL, $url);    $out = curl_exec($ch);    // line endings is the wonkiest piece of this whole thing    $out = str_replace("\r", "", $out);    // only look at the headers    $headers_end = strpos($out, "\n\n");    if ($headers_end !== false) {        $out = substr($out, 0, $headers_end);    }    $headers = explode("\n", $out);    foreach ($headers as $header) {        if (substr($header, 0, 10) == "Location: ") {            $target = substr($header, 10);            return $target;        }    }    return $url;}