配置文件详细信息未正确返

So I'm not getting the correct results returned for the user profile. Say I got to

http://localhost/scott

And when I'd look at the name for example I'd see Tony as a name. Even though the URL doesn't look like

 http://localhost/tony

Heres how I query

//Get link username
$actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$final =  parse_url($actual_link, PHP_URL_PATH);
$username = str_replace('/','',$final);

Here's how I get the user info

//Get user info
$stmt2 = $con->prepare("SELECT * FROM users WHERE username=:username");
$stmt2->bindValue(':username', $username, PDO::PARAM_STR);
$stmt2->execute();
$return = $stmt2->fetch(PDO::FETCH_ASSOC);

And here's how I get the results. $return['name']; is an example. I might get the profile picture and other info. I think this has something to do with my sessions, but I don't see any noticeable issues on the other files. Any ideas? No errors either.