Index: wp-includes/canonical.php
===================================================================
--- wp-includes/canonical.php	(revision 17231)
+++ wp-includes/canonical.php	(working copy)
@@ -79,6 +79,8 @@
 		}
 	}
 
+	$preg_prefix = '';
+
 	// These tests give us a WP-generated permalink
 	if ( is_404() ) {
 
@@ -150,6 +152,11 @@
 				$term_count += count( $tax_query['terms'] );
 
 			$obj = $wp_query->get_queried_object();
+			$taxonomy = get_taxonomy( $obj->taxonomy );
+			if ( $taxonomy->rewrite ) {
+				$preg_prefix = '(?<!/' . preg_quote( $taxonomy->rewrite['slug'], '#' ).  ')';
+			}
+
 			if ( $term_count <= 1 && !empty($obj->term_id) && ( $tax_url = get_term_link((int)$obj->term_id, $obj->taxonomy) ) && !is_wp_error($tax_url) ) {
 				if ( !empty($redirect['query']) ) {
 					if ( is_category() ) {
@@ -187,11 +194,11 @@
 
 		// paging and feeds
 		if ( get_query_var('paged') || is_feed() || get_query_var('cpage') ) {
-			while ( preg_match( "#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?$#", $redirect['path'] ) || preg_match( '#/(comments/?)?(feed|rss|rdf|atom|rss2)(/+)?$#', $redirect['path'] ) || preg_match( '#/comment-page-[0-9]+(/+)?$#', $redirect['path'] ) ) {
+			while ( preg_match( "#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?\$#", $redirect['path'] ) || preg_match( "#$preg_prefix/(comments/?)?(feed|rss|rdf|atom|rss2)(/+)?\$#", $redirect['path'] ) || preg_match( "#$preg_prefix/comment-page-[0-9]+(/+)?\$#", $redirect['path'] ) ) {
 				// Strip off paging and feed
-				$redirect['path'] = preg_replace("#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?$#", '/', $redirect['path']); // strip off any existing paging
-				$redirect['path'] = preg_replace('#/(comments/?)?(feed|rss2?|rdf|atom)(/+|$)#', '/', $redirect['path']); // strip off feed endings
-				$redirect['path'] = preg_replace('#/comment-page-[0-9]+?(/+)?$#', '/', $redirect['path']); // strip off any existing comment paging
+				$redirect['path'] = preg_replace("#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?\$#", '/', $redirect['path']); // strip off any existing paging
+				$redirect['path'] = preg_replace("#$preg_prefix/(comments/?)?(feed|rss2?|rdf|atom)(/+|\$)#", '/', $redirect['path']); // strip off feed endings
+				$redirect['path'] = preg_replace("#$preg_prefix/comment-page-[0-9]+?(/+)?\$#", '/', $redirect['path']); // strip off any existing comment paging
 			}
 
 			$addl_path = '';
