Two concatenated links throwing an error upon attempted logout I've looked everywhere, and can't seem to find an answer to my problem. I've written some code to toggle between a log in block and, once the user has logged in, a line of text that includes both a link to the logged-in user's profile (I have the Profile 2 module installed) and a log out link. 

Both the log in block and the line of text display nicely on my site when users log in and out. The problem comes when I click on the user profile link, which takes me to the user's profile page (which is correct). But then, when I click the "log out" link while on the profile page, it throws an error, rolling the two URLs into one.

Here is the code I included on the page.tpl.php:

  &lt;?php
    global $user;
    $var1 = $user-&gt;name;
    $var2 = 'Welcome back' . " " . '&lt;a href="/users/' . 
    str_ireplace(' ', '-', $var1) .  '"&gt;' . ucwords($user-&gt;name) . '&lt;/a&gt;' . " " . '|' . " " . '&lt;a href="user/logout"&gt;Log Out&lt;/a&gt;';
    if ($user-&gt;uid == false) {    
      print render($page['code']); 
    }
    else {
  ?&gt;
&lt;/div&gt;
&lt;div id="style2"&gt;
  &lt;?php print $var2; ?&gt;
&lt;/div&gt;           


(Not that it matters, I'm sure, but a few lines of this code are wrapped in div wrappers that this post wouldn't allow me to include.) When a user logs out from the profile page, this is the URL that results:

www.site.com/users/user/logout

Which obviously doesn't do the job of logging the user out. I want to emphasize that on every other page I've tested, the user can hit the log out link and be logged out with no problem; the issue only exists when trying to log out from the profile page. I suspect that I've coded something wrong with respect to the link HTML, but can't seem to figure out what the issue is. Any help would be much appreciated, thank you.
The issue is you have href="users/logout" not href="/users/logout", eg, it's a relative url, and thus building upon where you are in your site.