You can use this script to determine the real destination URL first, and then run httrack against this 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; }
source share