[wp-trac] Re: [WordPress Trac] #4554: Canonical trailing slashes

WordPress Trac wp-trac at lists.automattic.com
Fri Aug 10 08:29:48 GMT 2007

#4554: Canonical trailing slashes
 Reporter:  ryan            |        Owner:  markjaquith
     Type:  defect          |       Status:  assigned   
 Priority:  normal          |    Milestone:  2.3 (trunk)
Component:  Administration  |      Version:             
 Severity:  normal          |   Resolution:             
 Keywords:                  |  
Changes (by markjaquith):

  * owner:  anonymous => markjaquith
  * status:  new => assigned


 {{{canonical_rehash.001.diff}}} is pretty much a rewrite.

 The basic idea here is to look for known issues.  It doesn't try to be the
 end-all.  It fixes what it can, and doesn't bite off more than it can



  1. Trailing slashes (enforces user preference)
  1. example.com vs www.example.com (enforces user preference)
  1. strips trailing /index.php or /index.php/
  1. strips /index.php/ if using mod_rewrite permalinks, which allows for
 seamless migration from PATHINFO to mod_rewrite
  1. Redirects ?p=N, ?page_id=N, ?m=YYYY, ?m=YYYYMM, ?m=YYYYMMDD,
 ?year=YYYY, ?year=YYYY&monthnum=MM, ?year=YYYY&monthnum=MM&day=DD, ?cat=N,
 ?author=N, ?paged=N to their "pretty" counterparts.
  1. Always preserves additional args in the query string.
  1. Redirects is_single() URLs with partial slugs.  e.g. /2007/06/05/slug-
 fragment => /2007/06/05/slug-fragment-is-whole-now/
  1. Is non-greedy -- looks for specific cases that it can fix, but doesn't
 try to fix everything.

 I've used dozens of test cases, but I probably forgot a few along the way.
 Let me know what you think.

Ticket URL: <http://trac.wordpress.org/ticket/4554#comment:12>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software

More information about the wp-trac mailing list