Index: wp-includes/canonical.php
===================================================================
--- wp-includes/canonical.php	(revision 13169)
+++ wp-includes/canonical.php	(working copy)
@@ -141,17 +141,17 @@
 
 		// redirect sub-terms of taxonomies to their correct urls
 		if ( is_category() || is_tax() ) {
-			if ( is_category() ) {
-				$taxonomy = 'category';
-				$slug = get_query_var('category_name');
-			} else {
-				$taxonomy = get_query_var('taxonomy');
-				$slug = get_query_var('term');
+			if ($term = $wp_query->get_queried_object()) {
+				if ( is_category() ) {
+					$taxonomy = 'category';
+				} else {
+					$taxonomy = get_query_var('taxonomy');
+				}
+				if ( $tax_url = get_term_link($term, $taxonomy) ) {
+					$tax_url = parse_url($tax_url);
+					$redirect['path'] = $tax_url['path'];
+				}
 			}
-			if ( $tax_url = get_term_link($slug, $taxonomy) ) {
-				$tax_url = parse_url($tax_url);
-				$redirect['path'] = $tax_url['path'];
-			}
 		}
 
 		// paging and feeds
