- <?php
 - stream_context_set_default(array('http'=>array('method'=>'HEAD')));
 - $file = $_GET['file'];
 - $url = 'https://archive.archlinux.org/repos/last/' . urlencode($file);
 - $h = get_headers($url);
 - if (strpos($h[0], "200"))
 - {
 - header('Location: ' . $url);
 - }
 - else
 - {
 - preg_match("@([^/]+)-.+-.+-.+$@", $file, $match);
 - $url = 'https://archive.archlinux.org/packages/' . urlencode($match[1][0]) . '/' . urlencode($match[1]) . '/' . urlencode($match[0]);
 - header('Location: ' . $url);
 - }
 - ?>