WordPress.org

Make WordPress Core

Ticket #8642: canonical.diff

File canonical.diff, 783 bytes (added by jhodgdon, 5 years ago)

Patch to fix this bug by stripping /feed/ out of the middle of URLs in canonical redirect code

  • canonical.php

     
    137137                                // Strip off paging and feed 
    138138                                $paged_redirect['path'] = preg_replace('#/page/[0-9]+?(/+)?$#', '/', $paged_redirect['path']); // strip off any existing paging 
    139139                                $paged_redirect['path'] = preg_replace('#/(comments/?)?(feed|rss2?|rdf|atom)(/+)?$#', '/', $paged_redirect['path']); // strip off feed endings 
     140                                $paged_redirect['path'] = preg_replace('#/(feed|rss2?|rdf|atom)/#', '/', $paged_redirect['path']); // strip off feed in middle 
     141 
    140142                                $paged_redirect['path'] = preg_replace('#/comment-page-[0-9]+?(/+)?$#', '/', $paged_redirect['path']); // strip off any existing comment paging 
    141143                        } 
    142144