Make WordPress Core


Ignore:
Timestamp:
06/02/2004 05:16:44 AM (21 years ago)
Author:
rboren
Message:

Rewrite rule fixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r1376 r1381  
    11751175}
    11761176
    1177 function generate_rewrite_rules($permalink_structure = '') {
     1177function generate_rewrite_rules($permalink_structure = '', $matches = '') {
    11781178    $rewritecode =
    11791179    array(
     
    12001200    '([_0-9a-z-]+)',
    12011201    '([0-9]+)',
    1202     '(.*)',
     1202    '([/_0-9a-z-]+)',
    12031203    '([_0-9a-z-]+)'
    12041204    );
     
    12681268                $query = $index . '?' . $query . '&page=' . preg_index($num_toks + 1, $matches);
    12691269        } else {
    1270             $match .= '?';
     1270            $match .= '?$';
    12711271            $query = $index . '?' . $query;
    12721272        }
     
    12991299    }
    13001300
    1301     $post_rewrite = generate_rewrite_rules($permalink_structure);
     1301    $post_rewrite = generate_rewrite_rules($permalink_structure, $matches);
     1302
     1303    $feedregex = '(feed|rdf|rss|rss2|atom)/?$';
     1304    $pageregex = 'page/?([0-9]{1,})/?$';
     1305    $front = substr($permalink_structure, 0, strpos($permalink_structure, '%'));   
    13021306
    13031307    // If the permalink does not have year, month, and day, we need to create a
     
    13071311        $doarchive = true;
    13081312        $archive_structure = $front . '%year%/%monthnum%/%day%/';
    1309         $archive_rewrite =  generate_rewrite_rules($archive_structure);
    1310     }
    1311 
    1312     $feedregex = '(feed|rdf|rss|rss2|atom)/?$';
    1313     $pageregex = 'page/?([0-9]{1,})/?$';
    1314     $front = substr($permalink_structure, 0, strpos($permalink_structure, '%'));   
     1313        $archive_rewrite =  generate_rewrite_rules($archive_structure, $matches);
     1314    }
    13151315
    13161316    // Site feed
     
    13391339
    13401340    $category_structure = $category_structure . '%category%';
    1341     $category_rewrite = generate_rewrite_rules($category_structure);
     1341    $category_rewrite = generate_rewrite_rules($category_structure, $matches);
    13421342
    13431343    // Authors
    13441344    $author_structure = $front . 'author/%author%';
    1345     $author_rewrite = generate_rewrite_rules($author_structure);
     1345    $author_rewrite = generate_rewrite_rules($author_structure, $matches);
    13461346
    13471347    // Put them together.
    1348     $rewrite = $site_rewrite + $category_rewrite + $author_rewrite + $post_rewrite;
     1348    $rewrite = $site_rewrite + $category_rewrite + $author_rewrite;
    13491349
    13501350    // Add on archive rewrite rules if needed.
     
    13521352        $rewrite = $rewrite + $archive_rewrite;
    13531353    }
     1354
     1355    $rewrite = $rewrite + $post_rewrite;
    13541356
    13551357    return $rewrite;
Note: See TracChangeset for help on using the changeset viewer.