Changeset 6115

Show
Ignore:
Timestamp:
09/14/07 19:41:23 (1 year ago)
Author:
markjaquith
Message:

Canonical fixes: Allow Pages to have /page/x/. Always trailing slash home when it is not paged. Strip extra trailing slashes off of /page/x///

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-includes/canonical.php

    r6112 r6115  
    7373                    $redirect_url = $requested_url; 
    7474                $paged_redirect = @parse_url($redirect_url); 
    75                 $paged_redirect['path'] = preg_replace('|/page/[0-9]+?/?$|', '/', $paged_redirect['path']); // strip off any existing paging 
     75                $paged_redirect['path'] = preg_replace('|/page/[0-9]+?(/+)?$|', '/', $paged_redirect['path']); // strip off any existing paging 
    7676                $paged_redirect['path'] = preg_replace('|/index.php/?$|', '/', $paged_redirect['path']); // strip off trailing /index.php/ 
    77                 if ( $paged > 1 && !is_singular() ) { 
     77                if ( $paged > 1 && !is_single() ) { 
    7878                    $paged_redirect['path'] = trailingslashit($paged_redirect['path']); 
    7979                    if ( $wp_rewrite->using_index_permalinks() && strpos($paged_redirect['path'], '/index.php/') === false ) 
    8080                        $paged_redirect['path'] .= 'index.php/'; 
    8181                    $paged_redirect['path'] .= user_trailingslashit("page/$paged", 'paged'); 
    82                 } elseif ( !is_home() && !is_singular() ){ 
     82                } elseif ( !is_home() && !is_single() ){ 
    8383                    $paged_redirect['path'] = user_trailingslashit($paged_redirect['path'], 'paged'); 
    8484                } 
     
    133133            } 
    134134        $redirect['path'] = user_trailingslashit($redirect['path'], $user_ts_type); 
     135    } elseif ( is_home() ) { 
     136        $redirect['path'] = trailingslashit($redirect['path']); 
    135137    } 
    136138