If the path of a node has changed & "Do not flush expired content on cron run, instead re-crawl and overwrite it" is set and the old path gives a 301 due to Path Redirect then the old path will still give a 200 instead of a 301. There are several ways to fix the issue.

* Put a fix in boost_exit so any call to drupal_goto flushes the cache. Because hook_exit does not give me the redirect code I need to recreate the conditions that created the redirect via code from path_redirect_init() & globalredirect_init(). Other option is to assume if the code doesn't have destination=X then it was created by a module.

* Flush the file, then crawl the url, from inside the crawler.

* Detect path changes and kill the old file from boost_nodeapi

Comments

mikeytown2’s picture

This detects path changes... I should add it in. Runs under case 'presave': in nodeapi.

/**
 * Implementation of hook_node_presave().
 *
 * Creates automatic redirects when URL aliases are manually changed.
 */
function path_redirect_node_presave($node) {
  if (path_redirect_var('auto_redirect') && !empty($node->path)) {
    $node_path = 'node/'. $node->nid;
    $old_alias = drupal_get_path_alias($node_path, ($node->language ? $node->language : ''));
    if ($old_alias != $node_path && $node->path != $old_alias) {
      // If the user is manually changing the path alias, add a redirect from the old alias to the node.
      path_redirect_save(array('path' => $old_alias, 'redirect' => $node_path));
    }
  }
}
mikeytown2’s picture

Status: Active » Needs review
StatusFileSize
new2.92 KB

This does #1 & #3 from the original post

mikeytown2’s picture

StatusFileSize
new8.04 KB

Does all 3. Will commit soon to make the 4pm dev build time.

mikeytown2’s picture

Status: Needs review » Fixed

committed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.