In one of the projects there was a requirement such that the view page of a specific content type's content will be redirected to a particular page.

For example:

Content type = test_content

When viewing a content of type test_content, user will be redirected to another page.

We used a custom module and have made a drupal redirect as shown below:

if($node->type == 'test_content'){
                case 'view':



The red marked code created a problem when drupal cron was initiated.

Drupal cron tries to index the view pages but when it encounters drupal_goto() it gets redirected without completing the cron.

I have solved it as below:

case 'view':
                    global $base_url;
                    $location = $base_url.'/desired_landing_page';


Add new comment