set_ConnectionParams('127.0.0.1','port','user','pswd'); $mwdb->connect(); $sql = $mwdb->query('SELECT 1+1 AS Sum'); $mwdb->disconnect(); $arr = mysql_fetch_assoc($sql); mysql_free_result($sql); $url = '/lyrics/'.$arr['Sum']; header("HTTP/1.1 301 Moved Permanently"); header("Location:".$url); header("Connection: close"); } catch (Exception $E) { TExceptionHandler::print_Exception($E); } ?> This works :)