Sometimes you want to redirect a page to another on drupal. You can do this using a simple function called drupal_goto().
On few sites I’ve enabled the PHP filter module and then created a new page with PHP code input format with drupal_goto(‘node/2’) to redirect the current page to a specified node. Bad idea.
I’ve noticed that, after this change, cron.php operations failed, if you have Search module enabled. On cron new contents are indexed by the Search module: when it got my PHP page, it tries to index it but suddenly is redirected to another. You can also found an error like “Maximum function nesting level of ‘100’ reached” on php error log, symptom of an indexing blocked by pages with drupal_goto inside.
- Comment all drupal_goto() instruction in your site within pages.
- Use an alternative method to redirect from a node to another.
- Run cron from Status Report page: you can adjust indexed content per cron on Search configuration page (admin/settings/search on 6.x)
You can add a new block with PHP code inside or (better) create a new module for this simple block (with a simple PHP switch statement as content), displaying it only on specified pages (on the bottom of block configuration). But if you create a PHP block via UI, and you put that block on every page, your site could be loop, so creating a module is the cleanest and secure way (if something go wrong, you can delete your module from the codebase and correct it). You can also find some contrib modules for redirect on drupalmodules.com.
- Fatal error: Maximum function nesting level of ‘100’ reached, aborting! – an identical issue on drupal.org
- drupal_goto() function (Drupal 6.x)