Non ho capito se vuoi mantenere l'autenticazione HTTP, al limite dai uno sguardo quì http://php.nohup.it/manual/it/features.http-auth.phpCodice PHP:
mysql_connect('localhost', 'username_mysql', 'password_mysql');
mysql_select_db('nome_db');
$username = $_POST['username']; //Fai i controlli che devi fare
$password = md5($_POST['password']);
$query = mysql_query("SELECT url FROM clienti WHERE username = '{$username}' AND password = '{$password}' LIMIT 1");
$redirect = @mysql_result($query,0,0);
if($redirect) header("Location: $redirect");
header("Location: https://www.dominio.it/clienti/");