[wp-trac] Re: [WordPress Trac] #8098: trailing p's removed from query by canonical redirect

WordPress Trac wp-trac at lists.automattic.com
Sat Nov 8 09:28:40 GMT 2008


#8098: trailing p's removed from query by canonical redirect
---------------------+------------------------------------------------------
 Reporter:  DD32     |        Owner:  anonymous
     Type:  defect   |       Status:  new      
 Priority:  normal   |    Milestone:  2.7      
Component:  General  |      Version:  2.7      
 Severity:  normal   |   Resolution:           
 Keywords:           |  
---------------------+------------------------------------------------------
Comment (by azaozz):

 Replying to [comment:7 DD32]:
 > ... I'm not sure which'd be faster, I assume the word boundary would be.

 This is usually a very short string, so speed is not that important.
 {{{
 '#(^p|^page_id|^cat|^tag|&p|&page_id|&cat|&tag)=?$#'
 }}}
 > Hm, That could work, looks a bit ugly though (but what regex doesnt?)

 I think this can also be written as:
 {{{
 '#(^|&)(p|page_id|cat|tag)=?$#'
 }}}
 and if added at the end, it will also clean example 3 above, so
 'p=&tag=php' => 'tag=php'
 {{{
 '#(^|&)(p|page_id|cat|tag)=?(&|$)#'
 }}}
 Of course this will have to be well tested first to make sure it doesn't
 break anything else.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/8098#comment:8>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list