I want to set joomla site to redirect visiting users to registration page if my cookie is not set.
I've put below code in top of the (after imports) template index.php file.
if (empty($_COOKIE["abc"])){
$app = &JFactory::getApplication();
$link = "index.php?option=com_users&view=registration";
$app->redirect($link);
exit();
}
URL is redirect but it is going in loop. so page not loading correctly.
This is fire bug screen shot

How to omit this loop ? Thanks.