Ticket #14288: canonical_trunk.diff
File canonical_trunk.diff, 3.1 KB (added by , 13 years ago) |
---|
-
wp-includes/canonical.php
187 187 188 188 // paging and feeds 189 189 if ( get_query_var('paged') || is_feed() || get_query_var('cpage') ) { 190 if ( !$redirect_url ) 191 $redirect_url = $requested_url; 192 $paged_redirect = @parse_url($redirect_url); 193 while ( preg_match( "#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?$#", $paged_redirect['path'] ) || preg_match( '#/(comments/?)?(feed|rss|rdf|atom|rss2)(/+)?$#', $paged_redirect['path'] ) || preg_match( '#/comment-page-[0-9]+(/+)?$#', $paged_redirect['path'] ) ) { 190 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'] ) ) { 194 191 // Strip off paging and feed 195 $ paged_redirect['path'] = preg_replace("#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?$#", '/', $paged_redirect['path']); // strip off any existing paging196 $ paged_redirect['path'] = preg_replace('#/(comments/?)?(feed|rss2?|rdf|atom)(/+|$)#', '/', $paged_redirect['path']); // strip off feed endings197 $ paged_redirect['path'] = preg_replace('#/comment-page-[0-9]+?(/+)?$#', '/', $paged_redirect['path']); // strip off any existing comment paging192 $redirect['path'] = preg_replace("#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?$#", '/', $redirect['path']); // strip off any existing paging 193 $redirect['path'] = preg_replace('#/(comments/?)?(feed|rss2?|rdf|atom)(/+|$)#', '/', $redirect['path']); // strip off feed endings 194 $redirect['path'] = preg_replace('#/comment-page-[0-9]+?(/+)?$#', '/', $redirect['path']); // strip off any existing comment paging 198 195 } 199 196 200 197 $addl_path = ''; … … 225 222 $redirect['query'] = remove_query_arg( 'cpage', $redirect['query'] ); 226 223 } 227 224 228 $ paged_redirect['path'] = user_trailingslashit( preg_replace('|/index.php/?$|', '/', $paged_redirect['path']) ); // strip off trailing /index.php/229 if ( !empty( $addl_path ) && $wp_rewrite->using_index_permalinks() && strpos($ paged_redirect['path'], '/index.php/') === false )230 $ paged_redirect['path'] = trailingslashit($paged_redirect['path']) . 'index.php/';225 $redirect['path'] = user_trailingslashit( preg_replace('|/index.php/?$|', '/', $redirect['path']) ); // strip off trailing /index.php/ 226 if ( !empty( $addl_path ) && $wp_rewrite->using_index_permalinks() && strpos($redirect['path'], '/index.php/') === false ) 227 $redirect['path'] = trailingslashit($redirect['path']) . 'index.php/'; 231 228 if ( !empty( $addl_path ) ) 232 $ paged_redirect['path'] = trailingslashit($paged_redirect['path']) . $addl_path;233 $redirect_url = $ paged_redirect['scheme'] . '://' . $paged_redirect['host'] . $paged_redirect['path'];234 $redirect['path'] = $ paged_redirect['path'];229 $redirect['path'] = trailingslashit($redirect['path']) . $addl_path; 230 $redirect_url = $redirect['scheme'] . '://' . $redirect['host'] . $redirect['path']; 231 $redirect['path'] = $redirect['path']; 235 232 } 236 233 } 237 234