Redirect anonymous users to login when they try to access home page for omega sub theme I would like to redirect my anonymous users to login when they request my Drupal website. I have found many solutions for many themes but not for omega's sub theme. I like my site to limit for authenticated users.

When I used this rule:

{ "rules_test" : {
    "LABEL" : "Test",
    "PLUGIN" : "reaction rule",
    "REQUIRES" : [ "rules" ],
    "ON" : [ "init" ],
    "IF" : [
      { "user_has_role" : {
          "account" : [ "site:current-user" ],
          "roles" : { "value" : { "1" : "1" } }
        }
      }
    ],
    "DO" : [ { "redirect" : { "url" : "user\/login" } } ]
  }
}


browser shows:


  The page isn't redirecting properly.


What 's I missing?
Implement a hook_init().

function YOURMODULE_init(){
  global $user;
  if($user-&gt;uid == 0){
    drupal_goto('user/login');
  }
}


This will work but if you have cache / reverse proxy cache enabled then you might need to consider about a JS solution too.