Site move caused a change in taxonomy term tids; serp implications

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
Mike_Waters's picture

In the process of converting a D5 site to D6 (with a major structural redesign), the tids of terms were changed (there was no way to prevent it - the changes were very broad).

Unfortunately, I just discovered that we had some serps for high-value keywords attached to some /taxonomy/term/tid pages, which now point to completely different terms.

I had an idea of how I might ameliorate this, and hoped the group might have some feedback:

1) Remove taxonomy/term/tid pages from search engine indexes, moving forward, replacing them with a custom URL
- Use Taxonomy Redirect module (or just hook_term_path() myself) to provide new URLs for every term.
- Resubmit a sitemap with new taxonomy term URLs to search engines.
- Block taxonomy/term/tid in robots.txt

2) Use Path Redirect module to re-route any attempts to access pages in the form of /taxonomy/term/tid, using a 301 redirect
- Create a 301 redirect for each page, pointing to the new taxonomy redirect for the term that the search engine thinks it is looking for
OR
- hook_boot() checking ?q and performing the redirect manually using header('301'...); in this case I could check the referer to make sure it came from a serp.

I really appreciate any review.
-Mike

Comments

settings.php

narres's picture

I'm usually doing this in a manner like this:

<?php
function custom_url_rewrite_outbound(&$path, &$options, $original_path) {
    if (
substr($path, 0, strlen("taxonomy/term/")) == "taxonomy/term/") {
     
$termid = substr($path, strlen("taxonomy/term/"));
     
$termname = taxonomy_get_term($termid);
     
$path = "tag/".htmlspecialchars($termname->name).".".$termid."/";
    }
}

function
custom_url_rewrite_inbound(&$result, $path, $path_language) {
    if (
substr($path, 0, strlen("tag/")) == "tag/") {
     
$termid = substr(strrchr($path, "."), 1);
     
$result = "taxonomy/term/".$termid;
    }
}
?>

It does
From: taxonomy/term/$TID
To: tag/$NAME.$TID

And a combination of

<?php
function custom_redir() {
  global
$base_url;
 
$base_host = parse_url($base_url, PHP_URL_HOST);

  if (
$_SERVER['HTTP_HOST'] == $base_host) // This has to be set for your special case
   
return;
 
$protocol = "http";
 
header('HTTP/1.1 301 Moved Permanently');
 
header('Location: '. $protocol .'://' . $base_host . '' . request_uri());
  return;
}

custom_redir ();
?>

Do you see any holes in the

Mike_Waters's picture

Do you see any holes in the method outlined above? Am I just going to make it worse?

URL changes

Susan Rust's picture

We moved a site from Cold Fusion to Drupal. The CF site had hundreds of inbound links and was a nationally ranking website so we couldn't afford to lose the inbound links. It was detailed work but pretty simple:

  1. Create an excel list of every url inbound to the site
  2. Create another column that has the page it is landing on
  3. Create another column with the new url

We use the concatenation function to write a new .ht access file
No problems when we made the switch. Hope that helps

Search Engine Optimization (SEO)

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week