restrict visiting user/1 path for all users except admin I would like to add a condition that users are not able to visit admin profile using user/1 in url. (not even if url contains alias).
What would be the easiest way of doing that? I do not want to install additional module just for this task. Thank you.
You can do this in page.tpl.php

global $user;
global $base_url;
$uid=$user-&gt;uid;
if(agr(0)=='user' &amp;&amp; arg(1)==1)
{
if($uid!=1)
{
drupal_goto($base_url);
}
}


OR 

function YOURTHEMENAME_preprocess_page($vars) {
  if ($_GET['q'] == "user/1")
  {
    $usr = user_load(arg(1));
    if(!in_array('administrator',$usr-&gt;roles) ){
         drupal_goto("ANY PAGE"); //Example &lt;front&gt; for the homepage
    }
  }
 }


Hope this will work