I'm having the following problem:

1) taxonomy term has "&", example: diamonds&pearls
2) I had set the address with "path/!name", the separator for "-", and added the exception for remove text with "&" (stand alone)
3) the resulted path is http://www.site.com/path/diamond--pearls

That doesn't match with the default for Pathauto, for example (it would construct the path as http://www.site.com/path/diamond-pearls, with only one separator).

A suggestion: this module could use the function pathauto_cleanstring() from Pathauto to filter the final path, only if this module is installed in the system (or you give an admin option to use that); in this way, the path string transformation would always match perfectly.

Thanks for attention!

Comments

dean.p’s picture

I had the same problem. By default, "diamonds & pearls" with '&' specified in the Remove text would result in "diamonds--pearls".

I added "$path = preg_replace('/\s+/', ' ', $path);" to the taxonomy_redirect.module code below (Indicated as new):

// Remove text if necessary
  $text = array_filter(preg_split("/\n|\r/", $remove_text), 'taxonomy_redirect_filter_empty_lines');
  if (count($text) != 0) {
      $path = str_replace($text, "", $path);
  }
      // ---------- New
      $path = preg_replace('/\s+/', ' ', $path);
      // ---------- End New

  // Replace separators if necessary.
  if ($separator || $separator === '0') {
    $path = str_replace(array(' ', '+'), $separator, $path);
  }

This takes any spaces greater than one and reduces it to a single space.... result is "diamonds-pearls"

Rob T’s picture

Thanks for this. The on-board help for taxonomy redirect makes it seem like this particular scenario is covered, but it's not.